Skip to content

关于 UIViewController 的modalPresentationStyle属性设置问题 #2

Closed
@liwenDeng

Description

@liwenDeng

Modal转场实践 中提到

UIKit 已经为 Modal 转场实现了多种效果,当 UIViewController 的modalPresentationStyle属性为.Custom 或.FullScreen时,我们就有机会定制转场效果,此时modalTransitionStyle指定的转场动画将会被忽略。

我理解的是如果要定制自定义的转场效果,必须将modalPresentationStyle 设置为.Custom 或者.FullScreen。但是我尝试将 modalPresentationStyle 设置为.Custom 和 .FullScreen 以外的其他值时,发现也会执行自定义的转场效果,不知道我这里是否理解错误了?

Activity

seedante

seedante commented on Mar 15, 2016

@seedante
Owner

其实这里的确是可以设置为其他值的也依然能够实现自定义的转场动画,实际上,当我们在转场代理里提供了动画控制器后,系统就会认为交给你负责转场了,Modal 转场在这一块需要设置的参数更多,内部的实现并没有过滤掉这个,当发现你提供了转场代理以及动画控制器后还是执行了你自定义的方案。不过我当时试验发现后期会有些瑕疵,不知道为何我没有把这个也记录下来,现在也不记得哪里会有问题,唯一确定的是在与 UIPresentationController 配合时该属性必须为.Custom。

seedante

seedante commented on Mar 15, 2016

@seedante
Owner

简单试了下,在.PageSheet, .FormSheet模式下,会对动画控制器决定的布局产生影响,这两种模式下都没有移除 presentingView,这点和.Custom 模式下相同。

coderMR

coderMR commented on Mar 17, 2016

@coderMR

感谢分享

seedante

seedante commented on Mar 18, 2016

@seedante
Owner

Close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @seedante@coderMR@liwenDeng

        Issue actions

          关于 UIViewController 的modalPresentationStyle属性设置问题 · Issue #2 · seedante/iOS-Note