小编Rem*_*say的帖子

如何获取UINavigationController的rootViewController

我想获得UINavigationController的rootViewController.它在Objective-c中工作,但是当我在Swift中使用它时,错误提醒我它是错误的.

代码截图1.

如果我这样做,添加as! NSArray,它的工作原理,但也提醒我"从'[UIViewController]'转换为无关类型'NSArray'总是失败".

代码截图2

有人可以显示更好的方法来获取`rootViewController``而不会出错.谢谢.

ios swift rootviewcontroller

18
推荐指数
2
解决办法
3万
查看次数

标签 统计

ios ×1

rootviewcontroller ×1

swift ×1