swift - 在 Swift 中为更多 View Controller 自定义 TableView ?

标签 swift ios8 delegates tableview datasource

我想更改 More View Controller 的外观,它是在 TabBar 有很多选项卡时创建的。 到目前为止,我已经设法在 AppDelegate 中访问它并更改其 Navigation Bar 的外观。它看起来像这样:

enter image description here

但是,我似乎找不到访问和更改“moreNavigationController”中显示的 TableViewController 的方法。

对我来说最好的方法是在不同的 Swift 文件中访问它,但是当我创建 UITabBarController 文件并尝试访问 UITableViewDataSource 时,它会弹出一个错误提示它不符合此协议(protocol)(这就是我在 Objective-C 中设法做到这一点的方式)。

如何访问 More View Controller 中的 Table View

最佳答案

Root View Controller 的 View 是您要查找的 UITableView,因此这正是您访问它的方式:

UITableView* moreTableView=((UITableView*)[moreNavigationController.viewControllers objectAtIndex:0]).view;

关于swift - 在 Swift 中为更多 View Controller 自定义 TableView ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28793869/

相关文章:

ios - 使用未声明的类型 'SideMenuNavigationControllerDelegate' 错误

ios - 如何接收 json 字符串并将其转换为字典?

swift - 错误信息 Could not cast value type error - Swift

swift - Swift 闭包问题

ios - 从应用程序中更改默认搜索引擎

c++ - Objective-C 协议(protocol)委托(delegate)不工作

ios - Swift:如果用户接受或拒绝通知则采取行动

ios - 更改 ios8 扩展导航栏颜色

iphone - xCode 6 的新模拟器上的可调整大小的 iPhone 和可调整大小的 iPad 是什么?

iOS,在不使用 segue 的情况下为场景设置委托(delegate)