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
}
精彩评论