开发者

function that runs all the time in xcode?

I want to make a function that is a开发者_开发百科lways running in xcode similar to Unity's "function Update()". is this possible and if so, how.


You'll want to read up on run loops and NSTimers.


This code work for me,Hope it will help you!

write this function in your viewDidLoad() method

    [self performSelector:@selector(onTick:) withObject:nil afterDelay:2.0];

And Here is the onTick: Method do whatever you want to run all the time

-(void)onTick:(NSTimer *)timer
  {

  //do something here

  }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜