3

How do you change the colour of only the UIActivityViewController?

I want to change the colour of just the UINavigationBar of the UIActivityViewController using something like:

self.activityViewController.navigationController.navigationBar.barTintColor = [UIColor greenColor];
Bobi
  • 437
  • 1
  • 8
  • 20
  • possible duplicate of [Glitch with UIActivityViewController](http://stackoverflow.com/questions/21764552/glitch-with-uiactivityviewcontroller) – Pawan Rai Feb 13 '14 at 20:56

2 Answers2

1

I would suggest to change the background color of the UINavigationBar before creating and presenting your UIActivityViewController with:

 [UINavigationBar appearance].backgroundColor = [UIColor greenColor];

HTH

anka
  • 3,817
  • 1
  • 30
  • 36
  • This doesn't seem to work for me when inserting it in the button click method that brings up the ActivityView: I inserted it above my [self presentViewController:activityViewController animated:YES completion:nil]; and even tried: [self presentViewController:activityViewController animated:YES completion:^{[self presentViewController:activityViewController animated:YES completion:nil];}]; – Bobi Feb 13 '14 at 21:40
  • 1
    I am sorry, I mentioned the wrong property. Pleas try to set the color like that: `[UINavigationBar appearance].barTintColor = [UIColor greenColor];` – anka Feb 14 '14 at 07:49
  • That gives the same effect as what I used. Unfortunately it changes any childViewController tintColor too, which I am avoiding. – Bobi Feb 14 '14 at 14:17
  • Try to set the tint color of the navigation bar additionally right after the statement above. – anka Feb 17 '14 at 14:50
0

Following code maybe help you:

[[UINavigationBar appearanceWhenContainedIn:[UIActivityViewController class], nil]
           setTintColor:[UIColor greenColor]];
simalone
  • 2,768
  • 1
  • 15
  • 20
  • I do not think that this code will work, because the `UINavigationBar` is not a subclass of `UIActivityViewController`. `UIActivityViewController` will be embedded within a `UINavigationController`. – anka Feb 17 '14 at 14:49