码迷,mamicode.com
首页 > 移动开发 > 详细

iOS疯狂详解之 登陆后淡入淡出更换rootViewController

时间:2015-04-09 15:35:02      阅读:156      评论:0      收藏:0      [点我收藏+]

标签:ios开发   animation   

- (void)restoreRootViewController:(UIViewController *)rootViewController
{
    typedef void (^Animation)(void);
    UIWindow* window = self.window;
    
    rootViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    Animation animation = ^{
        BOOL oldState = [UIView areAnimationsEnabled];
        [UIView setAnimationsEnabled:NO];
        window.rootViewController = rootViewController;
        [UIView setAnimationsEnabled:oldState];
    };
    
    [UIView transitionWithView:window
                      duration:0.5f
                       options:UIViewAnimationOptionTransitionCrossDissolve
                    animations:animation
                    completion:nil];
}

iOS疯狂详解之 登陆后淡入淡出更换rootViewController

标签:ios开发   animation   

原文地址:http://blog.csdn.net/wanglongblog/article/details/44959609

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!