简体   繁体   English

更改moreNavigationController图标的颜色

[英]Change the color of moreNavigationController's icons

I've managed to change the navBar tint, the background color and labels' color using this . 我已设法使用更改navBar色调,背景颜色和标签的颜色。

But is it possible to change the icons' color? 但是有可能改变图标的​​颜色吗?

(those left to tableview's labels) (那些留给tableview的标签)

Thanks! 谢谢!

我完成了一半的工作

I don't know of a way to change the icon colors, but I don't really think all this hacking is necessary anyway - Apple certainly doesn't recommend it . 我不知道改变图标颜色的方法,但我并不认为所有这些黑客都是必要的 - 苹果当然不推荐它

As far as I can tell, there is nothing special about the moreViewController, apart from being hard to customize. 据我所知,除了难以定制之外,moreViewController没有什么特别之处。 If it were me, I'd simply create my own custom viewcontroller, say MoreViewController, as a subclass of UITableViewController, add it to a NavigationController and then add that as the fifth and last item in the TabBarController. 如果是我,我只是创建我自己的自定义视图控制器,比如MoreViewController,作为UITableViewController的子类,将其添加到NavigationController,然后将其添加为TabBarController中的第五个和最后一个项目。 This table would then have a cell for each additional viewcontroller that I'd like to show. 然后,该表将为我想要显示的每个附加视图控制器创建一个单元格。 Then I'd be free to customize these cells to my heart's content. 然后,我可以根据自己的心情自由定制这些细胞。

This is an old question, nevertheless I'll post a fairly reasonable solution I found. 这是一个老问题,但我会发布一个相当合理的解决方案。

I first tried setting the global tint color to what I wanted, but that didn't work. 我首先尝试将全局色调颜色设置为我想要的颜色,但这不起作用。 Luckily, simply changing the tint color of the table view did work. 幸运的是,只需更改表格视图的色调颜色可以了。 Adapting code from here : 这里调整代码:

let color: UIColor
// ...
if let moreTableView = moreNavigationController.topViewController?.view as? UITableView {
    moreTableView.tintColor = color
}

This still doesn't seem to affect the edit view controller, however. 但是,这似乎仍然不会影响编辑视图控制器。

EDIT: There is actually a simpler way to do both, see this answer . 编辑:实际上有两种更简单的方法,请参阅此答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM