我已经浏览了许多网站,但仍然没有回答。
我有一个方法假设void xyz(),,它将在之后每3秒自动从视图控制器调用。
我不知道该使用什么,我必须使用NSThread还是NSThread
发布于 2014-03-05 09:13:06
当您的视图出现在ViewDidLoad设备或模拟器中时,将从method.ViewDidLoad调用此方法。
[NSTimer scheduledTimerWithTimeInterval:3.0f target:self selector:@selector(runMethod) userInfo:nil repeats:YES];
-(void)runMethod
{
}发布于 2014-03-05 09:13:52
就像这样
-(void)xyz{
[self performSelectorInBackground:@selector(xyz) withObject:nil];
}
- (void)viewDidLoad {
[self performSelector:@selector(xyz) withObject:nil afterDelay:0.3];
}发布于 2014-03-05 09:16:07
使用NSTimer
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:3.0f target:self selector:@selector(xyz) userInfo:nil repeats:YES];https://stackoverflow.com/questions/22193131
复制相似问题