我正在使用 UIColor(patternImage:)
来改变 UINavigationBar
的颜色
UINavigationBar.appearance().barTintColor = UIColor(patternImage: UIImage(named: "Bar")!)
但是当我尝试使用 UIActivityViewController 在 Facebook 或 Twitter 上分享时,我得到了那个错误 Termating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Only RGBA or White color spaces are supported in this situation
有没有其他方法可以实现这一点?
* 更新 *
目前唯一可行的解决方案是更改所有 ViewController 中的每个 UINavigationBar 色调
self.navigationController?.navigationBar.barTintColor = UIColor(patternImage: UIImage(named: "Bar")!)
最佳答案
尝试导航外观方法。
UIApplication.sharedApplication().statusBarStyle = UIStatusBarStyle.LightContent
UINavigationBar.appearance().setBackgroundImage(UIImage(named: "navBg.png"), forBarMetrics: UIBarMetrics.Default)
UINavigationBar.appearance().translucent = false
UINavigationBar.appearance().tintColor = UIColor.lightGrayColor()
注意:图片高度保持 64 像素。希望对您有所帮助。
在 info.plist 中添加 key View controller-based status bar appearance = NO
关于ios - UIColor patternImage 与 UIActivityViewController barTintColor 冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31814786/