【问题标题】:Displaying next view after splashscreen在启动画面后显示下一个视图
【发布时间】:2013-01-08 10:02:09
【问题描述】:

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

【问题讨论】:

标签: iphone objective-c ios cocoa-touch


【解决方案1】:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 方法中添加[self setUpSplash]; 方法。并在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];
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-22
    • 1970-01-01
    • 2021-09-17
    • 2014-12-11
    相关资源
    最近更新 更多