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

IOS 弹出模态透明的ViewController

时间:2016-02-01 22:12:05      阅读:577      评论:0      收藏:0      [点我收藏+]

标签:

ViewController *vcObj = [[ViewController alloc] initWithNibName:NSStringFromClass([ViewController class]) bundle:nil];
    UINavigationController *navCon = [[UINavigationController alloc] initWithRootViewController:vcObj];
    
    if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) {
        
        navCon.providesPresentationContextTransitionStyle = YES;
        navCon.definesPresentationContext = YES;
        navCon.modalPresentationStyle = UIModalPresentationOverCurrentContext;
        
        [self presentViewController:navCon animated:NO completion:nil];
    }
    else {
        
        AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
        [self presentViewController:navCon animated:NO completion:^{
            [navCon dismissViewControllerAnimated:NO completion:^{
                appDelegate.window.rootViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
                [self presentViewController:navCon animated:NO completion:nil];
                appDelegate.window.rootViewController.modalPresentationStyle = UIModalPresentationFullScreen;
                
            }];
        }];
    }

IOS 弹出模态透明的ViewController

标签:

原文地址:http://www.cnblogs.com/mythings/p/5176307.html

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