IOS完成代碼只讓履行一次
- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. [self performSelector:@selector(wangmumu:) withObject:@"100" afterDelay:1]; } - (void) wangmumu:(NSString *)han{ static dispatch_once_t hanwanjie; //只履行一次 dispatch_once(&hanwanjie, ^{ NSLog(@"12345678910"); }); int niha = [han intValue] - 1; if (niha == 10) { return; } [self performSelector:@selector(hanwanjie:) withObject:[NSString stringWithFormat:@"%d",niha] afterDelay:1]; }
【iOS完成代碼只履行一次】的相關資料介紹到這裡,希望對您有所幫助! 提示:不會對讀者因本文所帶來的任何損失負責。如果您支持就請把本站添加至收藏夾哦!