Xcode或iOS更新使下面的代码具有不同的功能,因为与以前不同的是,现在导航栏按钮背景具有背景色。有什么好办法吗?我希望所有按钮都有相同的全局颜色,但现在它会影响导航栏按钮,这是我不想要的。我希望它像以前一样透明。
[[UIButton appearance] setBackgroundColor:[Helper getColor:self.application.color]];

发布于 2018-01-15 04:36:26
由于这个特定的UIButton位于UINavigationBar中,您可以尝试应用第二个特定外观来“覆盖”第一个常规外观集。例如,特定地调用,
[[UIButton appearanceWhenContainedIn:[UINavigationBar class], nil]
setBackgroundColor:[UIColor clearColor] forState:state barMetrics:metrics];在你打电话之后,
[[UIButton appearance] setBackgroundColor:[Helper getColor:self.application.color]];用特定的重写一般。
文档链接:https://developer.apple.com/documentation/uikit/uiappearance
https://stackoverflow.com/questions/48250750
复制相似问题