Xcode Objective-C | iOS: delay function / NSTimer help?

前端 未结 7 1994
旧巷少年郎
旧巷少年郎 2021-02-01 15:32

So I\'m developing my first iOS application and I need help..

Simple program for now, I have about 9 buttons and when I press the first button, or any button, I just wan

7条回答
  •  [愿得一人]
    2021-02-01 15:52

    int64_t delayInSeconds = 0.6;
    dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
    dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
         do something to the button(s)
    });
    

提交回复
热议问题