我想在我的 UIView 代码中调用某个方法,比如每 5 分钟一次 - 我该如何实现?
最佳答案
您可以使用 NSTimer:
将以下内容放入您的 viewDidLoad(其中 300 是秒数):
[NSTimer scheduledTimerWithTimeInterval:300.0f
target:self
selector:@selector(updateMethod:)
userInfo:nil
repeats:YES];
然后创建您的更新方法:
- (void)updateMethod:(NSTimer *)theTimer {
// Your code goes here
}
关于iphone - 在我的 UIView 中每 5 分钟调用一次方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6614703/