当前位置: 移动技术网 > IT编程>移动开发>IOS > iOS实现代码只执行一次

iOS实现代码只执行一次

2019年07月24日  | 移动技术网IT编程  | 我要评论

摩登原始人游戏,背叛情歌吉他谱,快钱支付流程

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];
}

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网