fuz*_*oat 5 iphone cocoa-touch objective-c
快问,有没有办法指定@selector是另一个对象的方法.目前我通过使用本地方法调用远程方法来捏造一个解决方案,但它感觉很笨拙.
[NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(timerLocation) userInfo:nil repeats:YES]];
Run Code Online (Sandbox Code Playgroud)
.
- (void)timerLocation {
[[self dataModel] startUpdatingLocation];
}
Run Code Online (Sandbox Code Playgroud)
Joh*_*ker 11
这就是NSTimer方法的target部分内容.(即:您指定要作为目标调用的对象,并将对象的方法名称指定为选择器.) scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:
| 归档时间: |
|
| 查看次数: |
1549 次 |
| 最近记录: |