Skip to content

Instantly share code, notes, and snippets.

@zhangkn
Created May 4, 2018 02:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhangkn/36ebd56ac0809d21bf97b6f96dcfdb53 to your computer and use it in GitHub Desktop.
Save zhangkn/36ebd56ac0809d21bf97b6f96dcfdb53 to your computer and use it in GitHub Desktop.
单次的延时调用
//单次的延时调用的例子
%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