presentViewController 透明跳转

  • (void)presentViewController:(UIViewController *)viewControllerToPresent animated: (BOOL)flag completion:(void (^ __nullable)(void))completion

这个支持透明跳转,但是有版本限制

modalPresentationStyle
UIModalPresentationCurrentContext NS_ENUM_AVAILABLE_IOS(3_2),
UIModalPresentationOverCurrentContext NS_ENUM_AVAILABLE_IOS(8_0),

判断系统版本方法:

if (NSFoundationVersionNumber < NSFoundationVersionNumber_iOS_8_0) {
    self.modalPresentationStyle = UIModalPresentationCurrentContext;
} else {
    presentVC.modalPresentationStyle = UIModalPresentationOverCurrentContext;
}

好啦, 自定义 alert sheet 什么的也不在话下啦

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • /* UIViewController is a generic controller base class th...
    DanDanC阅读 1,872评论 0 2
  • 一:UIViewController模态跳转 复制代码 //展示模态视图 - (void)presentViewC...
    Areslee阅读 1,234评论 0 0
  • 1.自定义控件 a.继承某个控件 b.重写initWithFrame方法可以设置一些它的属性 c.在layouts...
    圍繞的城阅读 3,496评论 2 4
  • // //UIView.h //UIKit // //Copyright (c) 2005-2015 Apple ...
    李某lkb阅读 1,755评论 0 0
  • 春天总是带着希望带着一股浓浓的惬意,人生就在这四季交替中跌宕起伏,时而波澜壮阔时而平淡如水,有悲也有喜,想起过往,...
    fulen阅读 137评论 0 0