2
votes

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)

Whatsapp first screen (OK)

  • Second screen (not OK)

Whatsapp second screen (NOT OK)

  • Share by e-mail (OK)

Email (OK)

1
The solution from stackoverflow.com/a/47064914/3641812 helped me solve this problem.ricardopereira

1 Answers

1
votes

Just try by changing the UIWindow's tintColor in your Appdelegate method didFinishLaunchingWithOptions. It will then automatically pass as default to all its UIView descendants.

[self.window setTintColor:[UIColor whiteColor]];

Hope this will help you.

It could also be an issue with the third party which would be (overriding) setting the tintColor again.