How to set parentViewController in UIViewController?

前端 未结 6 827
春和景丽
春和景丽 2021-02-13 10:26

The parentViewController property of UIViewController is readonly, but I am nesting custom view controllers and would like to use this property.

However, since it is re

6条回答
  •  不思量自难忘°
    2021-02-13 11:07

    parentViewController is for the purposes of NavigationViewControllers and presenting modal view controllers , there is no way to set the property without the methods pushViewController or presentModalViewController. The parentViewController is a readonly property can only be read by the UIViewController class and UINavigationController class, subclasses of these will not have access to set the property.

提交回复
热议问题