启动画面后显示下一个视图 [英] Displaying next view after splashscreen

查看:46
本文介绍了启动画面后显示下一个视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在iphone的默认启动视图启动后加载我选择的视图.有人知道如何实现这一目标吗?我是xcode和ios开发的新手.

I want to load a view of my choice after the default splash view of iphone launches. Does someone know how to achieve this ? i am new to xcode and ios development.

推荐答案

-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary)中添加 [self setUpSplash]; 方法*)launchOptions 方法.并在 AppDelegate.m

Add [self setUpSplash]; method in - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions method. And add following Three method in AppDelegate.m

-(void) setUpSplash {
    self.splashImgView = [[UIImageView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
    [self.splashImgView setImage: [UIImage imageNamed:@"splash.png"]];
    [self.window addSubview: self.splashImgView];

    [NSTimer scheduledTimerWithTimeInterval:2.0f target:self selector:@selector(closeSplashWithTimer:) userInfo:nil repeats:NO];
}

- (void)closeSplashWithTimer:(NSTimer *)theTimer
{
    [UIView beginAnimations:@"ToggleViews" context:nil];
    [UIView setAnimationDuration:1.0];

    // Make the animatable changes.
    splashImgView.alpha = 0.0;
    self.mvNavigationController.view.alpha = 1.0;

    // Commit the changes and perform the animation.
    [UIView commitAnimations];

    [NSTimer scheduledTimerWithTimeInterval:2.0f target:self selector:@selector(closeSplashWithTimerAgain:) userInfo:nil repeats:NO];
}

- (void)closeSplashWithTimerAgain:(NSTimer *)theTimer
{
    [self.splashImgView removeFromSuperview];
}

这篇关于启动画面后显示下一个视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆