(iOS)viewController背景透明化

#ifdef __IPHONE_8_0

        if ([EFUNKakaoCenter deviceOsVersion].intValue < 8) {

            [UIApplication sharedApplication].keyWindow.rootViewController.providesPresentationContextTransitionStyle = YES;

            [UIApplication sharedApplication].keyWindow.rootViewController.definesPresentationContext = YES;

            [[UIApplication sharedApplication].keyWindow.rootViewController setModalPresentationStyle:UIModalPresentationCurrentContext];  //注意,iOS8以下是设置rootViewController为ModalPresentationCurrentContext模式

        } else {

            [self setModalPresentationStyle:UIModalPresentationOverCurrentContext];//iOS8或以上是设置要被present的viewController为ModalPresentationOverCurrentContext模式

        }

#else

        [UIApplication sharedApplication].keyWindow.rootViewController.providesPresentationContextTransitionStyle = YES;

        [UIApplication sharedApplication].keyWindow.rootViewController.definesPresentationContext = YES;

        [[UIApplication sharedApplication].keyWindow.rootViewController setModalPresentationStyle:UIModalPresentationCurrentContext];

#endif

 

posted @ 2015-04-21 14:49  MingFung_Liu  阅读(1542)  评论(0编辑  收藏  举报