动画加载屏幕后的Xcode切换视图控制器

时间:2014-09-02 03:59:27

标签: ios xcode viewcontroller

我已经关注了Geeky Lemon的动画加载屏幕教程--->的教程。 https://www.youtube.com/watch?v=P5nCSqppYHI(链接)

我想知道在动画加载屏幕之后,我可以切换到继续使用我的应用程序的主ViewController吗?

1 个答案:

答案 0 :(得分:0)

如果您正在学习该教程,您可以在动画完成后简单地按下所需的视图控制器,如下所示。只需将delay3方法替换为此方法,并替换您想要推送的视图控制器。

步骤 -

  1. 在您编写的当前实现文件中导入视图控制器的头文件 - (void)delay3方法,如下所示。

    #import "ViewController.h"

  2. 检查以下图片,并将pushNewScreen方法中的ID替换为情节提要中的ID。

  3. enter image description here

    - (void)delay3 {
        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration:1.0];//you can change animation time here.
        [Loadingimageview setAlpha:1.0];
        [UIView commitAnimations];
    
        // this method will call after 1 second you can change delay here.
        [self performSelector:@selector(pushNewScreen) withObject:nil afterDelay:1.0];
    }
    
    - (void)pushNewScreen {
        ViewController *newView = [self.storyboard instantiateViewControllerWithIdentifier:@"storyBoardIdentifier"];
        [self.navigationController pushViewController:newView animated:YES];
    }