ios - UIColor patternImage 与 UIActivityViewController barTintColor 冲突

标签 ios swift uinavigationbar uicolor uiactivityviewcontroller

我正在使用 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/

相关文章:

ios - 更改 UINavigationController 按钮的颜色

ios - 以编程方式将 UILabel 字体设置为用户定义的运行时属性

ios - UITableView 仅在向下滚动时加载项目

iOS removeFromSuperview 如果未添加到 superview 不会引发错误

swift - 有没有更有效的方法来在 Swift 中构建这种基于年龄组的 z 分数计算?

swift - AsyncDisplayKit - ASButton 大小

multithreading - Swift 是否有 Java ThreadPoolExecutor 的类似物?

swift - 更改 UINavigationBar 按钮图像

ios - 如何使用 swift 函数 loadLeaderboardSets WithCompletionHandler

ios - 如何每次使用 AFNetworking 读取响应 header ?