小智 5
你可以使用 NSRunLoop
- (BOOL)method {
__block BOOL finish = NO;
[[NSNotificationCenter defaultCenter] addObserverForName:@"myNotification" object:nil queue:nil usingBlock:^(NSNotification *note) {
finish = YES;
}];
while(!finish) {
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
}
return YES;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1182 次 |
| 最近记录: |