When I share an text to WhatsApp with the UIActivityViewController
the second screen of the sharing, for my case, has the wrong button colors.
The first screen is OK. This issue has been discussed a lot of times and one great bucket of answers can be found here: Cannot set text color of Send and Cancel buttons in the mail composer when presented from the UIActivityViewController in iOS7
The answer fixes for me the button colors of:
- MFMailComposeViewController
- And the first screen when sharing to WhatsApp
But for some reason not the second one.
This did the fix for the first screen:
[[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTintColor:[UIColor whiteColor]];
But even setting the appearance of all UIBarButtonItems is not working:
[[UIBarButtonItem appearance] setTintColor:[UIColor whiteColor]];
Example code not working:
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
Screenshots:
- First screen: (OK)
- Second screen (not OK)
- Share by e-mail (OK)