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

前端 未结 7 2010
旧巷少年郎
旧巷少年郎 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:51

    A slightly less verbose way is to use the performSelector: withObject: afterDelay: which sets up the NSTimer object for you and can be easily cancelled

    So continuing with the previous example this would be

    [self performSelector:@selector(goToSecondButton) withObject:nil afterDelay:.06];
    

    More info in the doc

提交回复
热议问题