hold view for 3 seconds then push for another view
I want to hold view for 3 seconds then view will be switch,What wil开发者_StackOverflow中文版l i do?
[self performSelector:@selector(changeMyView) withObject:nil afterDelay:3.0];
will call the method [self changeMyView]
after a delay of three seconds. You can also use NSTimer
to do the same thing. sleep(3)
will pause everything for three seconds, but it will pause everything, so it's probably not ideal.
Use sleep(3)
before pushing the new view controller
You can use NSTimer class to schedule whatever activity you wish. NSTimer does not block the UI thread so application remains responsive. But you need to be careful in handling the user interaction during this time.
Look into the NSTimer class. http://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/Timers/Timers.html
精彩评论