对于不通用方法,不需要独立成函数的,使用block让逻辑更紧凑。
试用block块:
1.afterDelay ---> dispatch_after()
[self performSelector:@selector(setSelectMenu:) withObject:cell afterDelay:0.5];
---->输入dispatch_after会有GCD块的提示,这个很方便,如下:
double delayInSeconds = 2.0;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
[self setSelectMenu:cell];
});
对对象发送performSelector方法比使用对象直接调用要方便些,不需要强转和添加相应类头文件