自定义 UITabBarController.moreNavigationController 个 UITableViewCells
Customise UITabBarController.moreNavigationController UITableViewCells
如标题所述,我正在尝试自定义 moreNavigationController 中的单元格。我已经阅读了很多询问类似问题的 SO 帖子,但大多数都已过时并且似乎是 hack。
我假设这是一种非常常见的情况,所以肯定有 'tidy' 方法可以做到这一点?
我已经研究过重写其中一种 tableviews 委托方法,但我什至无法假设它是可能的。我还尝试了以下方法:
override func viewDidLoad() {
super.viewDidLoad()
let moreNavController = self.moreNavigationController
if let moreTableView = moreNavController.topViewController?.view as? UITableView {
for cell in moreTableView.visibleCells {
cell.textLabel?.textColor = AppDarkColor
cell.imageView?.image = cell.imageView?.image?.imageWithRenderingMode(.AlwaysTemplate)
}
}
}
但是 moreTableView.visibleCells 至少在加载 UITabBarController
时是空的。也许我需要将它移到其他地方,但我不确定在哪里或这是否是正确的方法。
尝试将代码放入 viewWillAppear。它对我有用(至少)。希望对你有用!
如标题所述,我正在尝试自定义 moreNavigationController 中的单元格。我已经阅读了很多询问类似问题的 SO 帖子,但大多数都已过时并且似乎是 hack。
我假设这是一种非常常见的情况,所以肯定有 'tidy' 方法可以做到这一点?
我已经研究过重写其中一种 tableviews 委托方法,但我什至无法假设它是可能的。我还尝试了以下方法:
override func viewDidLoad() {
super.viewDidLoad()
let moreNavController = self.moreNavigationController
if let moreTableView = moreNavController.topViewController?.view as? UITableView {
for cell in moreTableView.visibleCells {
cell.textLabel?.textColor = AppDarkColor
cell.imageView?.image = cell.imageView?.image?.imageWithRenderingMode(.AlwaysTemplate)
}
}
}
但是 moreTableView.visibleCells 至少在加载 UITabBarController
时是空的。也许我需要将它移到其他地方,但我不确定在哪里或这是否是正确的方法。
尝试将代码放入 viewWillAppear。它对我有用(至少)。希望对你有用!