Quote:
Originally Posted by Cowlinn
Hi
I am trying to run an action 10 seconds after the screen appears. At the moment I have this
However this is being called before the view actually appears on the screen (At the end of the screen before)
I hope somebody could spare a minute or two to help me out.
Thanks a lot
|
As Baja says, sleep is really bad news in Cocoa. It causes the whole app to freeze up.
use code like this:
Code:
- (void) showMyView;
{
//create and install the view that you want to show up after a delay
}
- (void) viewDidAppear
{
[self performSelector: @selector(showMyView)
withObject: nil
afterDelay: 5.0];
}
The method peformSelector:withObject:afterDelay: sets up a method to be called after a delay. In this case, it will call a second method, showMyView. Move your code that creates and installs the view into that method.