【发布时间】:2017-06-20 10:08:01
【问题描述】:
当我使用 UIActivityViewController 向 WhatsApp 分享文本时,就我而言,分享的第二个屏幕按钮颜色错误。
第一个屏幕没问题。这个问题已经讨论过很多次了,在这里可以找到一大堆答案:Cannot set text color of Send and Cancel buttons in the mail composer when presented from the UIActivityViewController in iOS7
答案为我修复了以下按钮颜色:
- MFMailComposeViewController
- 和分享时的第一个屏幕 WhatsApp
但由于某种原因不是第二个。
这修复了第一个屏幕:
[[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTintColor:[UIColor whiteColor]];
但即使设置所有 UIBarButtonItems 的外观也不行:
[[UIBarButtonItem appearance] setTintColor:[UIColor whiteColor]];
示例代码不起作用:
self.window?.tintColor = UIColor.white
let activityController = UIActivityViewController.init(activityItems: items, applicationActivities: nil)
if let vc = delegate?.currentViewController() {
sender.isEnabled = false
vc.present(activityController, animated: true, completion: {
sender.isEnabled = true
})
activityController.navigationController?.navigationBar.tintColor = UIColor.white
activityController.view.tintColor = UIColor.white
截图:
- 第一个屏幕:(确定)
- 第二个屏幕(不正常)
- 通过电子邮件共享(确定)
【问题讨论】:
-
stackoverflow.com/a/47064914/3641812 的解决方案帮我解决了这个问题。
标签: ios uinavigationbar uiactivityviewcontroller mfmailcomposeviewcontroller uiappearance