iOS有用的代码
iOS有用的代码
//iOS设置navigation是否可用
self.navigationController.navigationBar.userInteractionEnabled
= YES;
//延迟执行某个方法
[self
performSelector: selector(showSVProgressHUD) withObject:nil
afterDelay:0.2];
//block
UIActivityIndicatorView *spiner = [[UIActivityIndicatorViewalloc]
initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
[spiner startAnimating];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItemalloc] initWithCustomView:spiner];
dispatch_queue_t
generatePassQueue = dispatch_queue_create(“passQueue”, NULL);
dispatch_async(generatePassQueue, ^{
[selfinitGeneratePassbook];
dispatch_async(dispatch_get_main_queue(), ^{
[self initPassbookBtn];
});
});
dispatch_release(generatePassQueue);
}
//让线程睡眠1秒钟
[NSThreadsleepUntilDate:[NSDatedateWithTimeIntervalSinceNow:1.0f]];