开发者

How to load other window with delay in iphone

I am loading my second screen with delay of 2 second. But I want to show my first screen as well for 2 second and after 2 second my second screen should be load. I have written code

[NSThread sleepForTimeInterval:2.0];

for delay. But my MainWindow is not appearing. I have written code inside of the function

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    开发者_开发问答



....


}

Where to write the code to show first screen for 2 second.

Thanks in advance.


You can use NSTimer for swap views like the following: You can setup the Timer on:

  -(void) swapViews{
    // add the second screen as subview of the app window. 
    }

           (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// add the first screen as subview of the app window. 
           [NSTimer scheduledTimerWithTimeInterval:2.0
                target:self
                selector:@selector(swapViews:)
                userInfo:nil
                repeats:NO];
            }


Use this method too

[self performSelector:@selector(test) withObject:nil afterDelay:2];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜