I have a UINavigationBar that has a background image set up in the app delegate class, so you can imagine why I would not like the Navigationbar to be translucent. I believe it is the culprit for this: http://imgur.com/v3e0NIo
Anyways when I put this line of code:
[[UINavigationBar appearance] setTranslucent:NO];
in my AppDelegate I encounter this error:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** Illegal property type, B for appearance setter, _installAppearanceSwizzlesForSetter:'
Even when I try to individually make every UINavigationbar non-transparent in each class, I still have that stupid white bar in the image! No errors are thrown though, which makes me wonder if the code just doesn't work, or if transparency is not my problem?
Thanks!
EDIT:
Here is the code I am using in my AppDelegate to make the custom background for the NavBar:
[[UINavigationBar appearance] setTitleTextAttributes: @{
UITextAttributeTextColor: [UIColor whiteColor],
UITextAttributeTextShadowColor: [UIColor blackColor],
UITextAttributeTextShadowOffset: [NSValue valueWithUIOffset:UIOffsetMake(0.0f, 1.0f)],
UITextAttributeFont: [UIFont fontWithName:@"Code-Bold" size:23.0f]
}];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault animated:NO];
UIImage *navBarImage = [[UIImage imageNamed:@"menubar.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(5, 15, 5, 15)];
[[UINavigationBar appearance] setBackgroundImage:navBarImage forBarMetrics:UIBarMetricsDefault];
Even when I make the UIViewController's background black, the white bar is still there.. I now highly doubt transparency is my problem!
Ty this and place it in the viewdidload
of each of the viewcontrollers classes instead:
self.navigationController.navigationBar.translucent = NO;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With