amitsbajaj amitsbajaj - 1 year ago 219
Objective-C Question

Set Done Button Colour on SFSafariViewController

I am using the

to access a website called from a
. Because my app has a very light feel attached to it, I have added the following line of code in the

self.window.tintColor = [UIColor whiteColor];

When running the
, I get the following:

enter image description here

Is there anyway I can change the colour of the
button to Blue (as per default)?

I've tried the following when calling the
but to no effect:

[self presentViewController:safariVC animated:YES completion:^{
safariVC.navigationController.navigationItem.rightBarButtonItem.tintColor = [UIColor blueColor];

[self presentViewController:safariVC animated:YES completion:^{
safariVC.navigationController.navigationBar.tintColor = [UIColor blueColor];

Neither of those work.

I could of course leave the app as default and take out the white setting from the
, but I want this approach within the app because Blue just stands out too much with custom themes.

Any guidance on this would be really appreciated.


You can change bar colours globally using appearance proxy:


[[UINavigationBar appearance] setTintColor:[UIColor blueColor]];
[[UIBarButtonItem appearance] setTintColor:[UIColor blueColor]];

else try

  [self presentViewController:safariVC animated:YES completion:^{

         [safariVC.navigationBar setTintColor:[UIColor blueColor]];

else try

in AppDelegate.m in the function:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

I've entered the following code:

[[UINavigationBar appearanceWhenContainedIn:[SFSafariViewController class], nil] setBarTintColor:[UIColor blueColor]];
[[UINavigationBar appearanceWhenContainedIn:[SFSafariViewController class], nil] setTintColor:[UIColor blueColor]];