How to change the color of an SFSafariViewController ToolBar

Expected Result: I want to change the color of the ToolBar to Dark Black.

Actual output: ToolBar - light gray.

Here is the code:

let webViewController = SFSafariViewController(URL: url, entersReaderIfAvailable: true) self.navigationController?.toolbar.barTintColor = UIColor.blackColor() self.navigationController?.toolbar.tintColor = UIColor.whiteColor() self.navigationController?.toolbar.barStyle = UIBarStyle.Black self.navigationController?.pushViewController(webViewController, animated: true) 
+8
objective-c iphone swift uitoolbar sfsafariviewcontroller
source share
2 answers

Updated response for iOS 10 API

SFSafariViewController now has the preferredBarTintColor and preferredControlTintColor properties to control how toolbars look.


Original answer

SFSafariViewController displays the process. You can only change the hue color, but not the dash or hue style.

To set the hue color, set the color of the safari shades as follows:

 let sfController = SFSafariViewController(URL: url, entersReaderIfAvailable: true) sfController.view.tintColor = UIColor.redColor() navigationController?.showViewController(sfController, sender: self) 
+16
source share

I see no way to change the background color of the ToolBar, but you can change the color of the buttons in the ToolBar.

 [UIBarButtonItem appearance].tintColor = [UIColor whiteColor]; 

All other changes in the appearance or directly in the properties of the controller do not affect, as I see.

0
source share

All Articles