关闭

关于viewDidLoad里调用presentModalViewController的问题

标签: applicationbutton
1155人阅读 评论(0) 收藏 举报
分类:
原贴地址:http://www.cocoachina.com/bbs/read.php?tid=97273

------------------------------------------------------------------------------------------------------------------------------------------------------
- (void)viewDidLoad 里调用presentModalViewController无效果,

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions里调用presentModalViewController就有效果

加个button,在button点击事件里调用presentModalViewController也没有问题

表示非常迷惑,为什么- (void)viewDidLoad 里调用presentModalViewController就没有效果呢。
明眼的大神帮忙解释下吧- -
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

在(void)viewDidAppear:(BOOL)animated里面调用吧

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

最后分享一个利用presentModalViewController方法制作的启动动画吧,大神见笑了

    - (void)viewDidAppear:(BOOL)animated{
        [loginViewController presentModalViewController:welcomeViewController animated:NO];
        [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(dismissModalView) userInfo:nil repeats:NO];
    }
    - (void)viewDidLoad {
        [super viewDidLoad];
        loginViewController = [[UIViewController alloc] init];
        loginViewController.view.frame = [[UIScreen mainScreen] bounds];
        loginViewController.view.backgroundColor = [UIColor redColor];
        [self.view addSubview:loginViewController.view];
       
        welcomeViewController = [[UIViewController alloc] init];
        welcomeViewController.view.frame = [[UIScreen mainScreen] bounds];
        UIImageView *welcomeImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Default.png"]];
        welcomeImageView.frame = CGRectMake(0, 0, 320, 460);
        [welcomeViewController.view addSubview:welcomeImageView];
    }
    - (void)dismissModalView{
        welcomeViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
        [welcomeViewController dismissModalViewControllerAnimated:YES];
    }
资源地址:http://download.csdn.net/detail/liyan5953wow/4162557


0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    文章分类
    文章存档