iOS实现代码只执行一次
程序员文章站
2023-08-12 15:52:46
ios实现代码只让执行一次
- (void)viewdidload {
[super viewdidload];
// do any addition...
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]; }
下一篇: 平时吃什么健脾好