How to pass arguments when calling function with timer in objective c

后端 未结 7 1528
我寻月下人不归
我寻月下人不归 2020-12-20 00:02
-(void)setX:(int)x andY:(int)y andObject:(Sprite*)obj
{
    [obj setPosition:CGPointMake(x,y)];
}

Now, I want to call above method, using following

7条回答
  •  盖世英雄少女心
    2020-12-20 00:20

    You'll need to used +[NSTimer scheduledTimerWithTimeInterval:invocation:repeats:] instead. By default, the selector used to fire a timer takes one parameter. If you need something other than that, you have to create an NSInvocation object, which the timer will use instead.

提交回复
热议问题