Amr Mohamed
Amr Mohamed

Reputation: 2380

UIColor patternImage conflict with UIActivityViewController barTintColor

i am using the UIColor(patternImage:) to change the color of UINavigationBar just like that

UINavigationBar.appearance().barTintColor = UIColor(patternImage: UIImage(named: "Bar")!)

but when i try to use the UIActivityViewController to share on Facebook or Twitter , i got that error Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Only RGBA or White color spaces are supported in this situation

is there any alternative approach to achieve this ?

* Update *

The only working solution for now is to change each UINavigationBar tint in all of the ViewControllers

self.navigationController?.navigationBar.barTintColor = UIColor(patternImage: UIImage(named: "Bar")!)

Upvotes: 1

Views: 558

Answers (1)

Avijit Nagare
Avijit Nagare

Reputation: 8782

Try navigation appearance method.

UIApplication.sharedApplication().statusBarStyle = UIStatusBarStyle.LightContent

    UINavigationBar.appearance().setBackgroundImage(UIImage(named: "navBg.png"), forBarMetrics: UIBarMetrics.Default)
    UINavigationBar.appearance().translucent = false
    UINavigationBar.appearance().tintColor = UIColor.lightGrayColor()

Note: Image hight keep 64 pixel.hope this help.

Add key in info.plist View controller-based status bar appearance = NO

Upvotes: 1

Related Questions