Created
May 4, 2018 02:50
-
-
Save zhangkn/36ebd56ac0809d21bf97b6f96dcfdb53 to your computer and use it in GitHub Desktop.
单次的延时调用
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//单次的延时调用的例子 | |
%new | |
- (void)setupWAMainListViewController | |
{ | |
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(19 * NSEC_PER_SEC)), | |
dispatch_get_main_queue(), ^{ | |
NSIndexPath * indexPatch = [NSIndexPath indexPathForRow:0 inSection:5];//小程序 | |
[self tableView:[self view] didSelectRowAtIndexPath:indexPatch]; | |
}); | |
} | |
//NSObject中的`performSelector:withObject:afterDelay:`以及 `performSelector:withObject:afterDelay:inModes:` | |
// 前者的 `timer` 在 `NSDefaultRunLoopMode` 运行,后者指定 **NSRunLoop** 的 `mode` 来执行。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment