我想获得UINavigationController的rootViewController.它在Objective-c中工作,但是当我在Swift中使用它时,错误提醒我它是错误的.
代码截图1.
如果我这样做,添加as! NSArray,它的工作原理,但也提醒我"从'[UIViewController]'转换为无关类型'NSArray'总是失败".
as! NSArray
代码截图2
有人可以显示更好的方法来获取`rootViewController``而不会出错.谢谢.
ios swift rootviewcontroller
ios ×1
rootviewcontroller ×1
swift ×1