iOS 模态跳转推出透明背景方法

1. OS >= iOS 8.0

FZLoginViewController *fzLoginViewController = [[FZLoginViewController alloc] init];
fzLoginViewController.modalPresentationStyle = UIModalPresentationOverCurrentContext;
[[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:fzLoginViewController animated:NO completion:nil];

2. 若系统需兼容7.0 需要加处理

if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) {
    controller.modalPresentationStyle = UIModalPresentationOverCurrentContext;
    [self presentViewController:controller animated:YES completion:nil];
} else {
    self.view.window.rootViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
    [self presentViewController:controller animated:NO completion:nil];
    self.view.window.rootViewController.modalPresentationStyle = UIModalPresentationFullScreen;
}

附:我的博客地址

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 发现 关注 消息 iOS 第三方库、插件、知名博客总结 作者大灰狼的小绵羊哥哥关注 2017.06.26 09:4...
    肇东周阅读 14,556评论 4 61
  • 01老城、书店、日料,今日份的女孩。我时常提醒自己要保留三分的神秘感,这是源于对被看透的恐惧,而今天的女孩,身上有...
    花酒诗书离阅读 3,106评论 3 1
  • 是你,便倾心; 是你,便安心; 是你,便开心; 陪你看山看水看世界,赏花赏月赏人间。 尘土飞扬,埋不住爱的足迹; ...
    我我ME阅读 1,868评论 1 2
  • 不知不觉今天周五了! 这周每天带着女儿去上班,跟着暑托班好欢乐! 在她第一天做完《宝葫芦的秘密》分享推荐后,第二天...
    婕宁捷妈妈阅读 1,301评论 0 0
  • 尊敬的老师亲爱的同学们: 大家好! 今天我国旗下讲话的题目是《致九年级的学哥学姐们》。 当五星红旗再次冉冉升起,我...
    七月淼淼阅读 1,571评论 0 0

友情链接更多精彩内容