2

i'm developping my first app on iOS 7 and facing a new problem.

What i want to do is to have a my UINavigationBar translucent AND colored,

how can i managed this ?

self.navigationController.navigationBarHidden = YES;
self.navigationController.navigationBar.translucent = YES;
self.navigationController.navigationBar.barTintColor = [UIColot greenColor];

if i set the bartintcolor the translucent property is no more valid.

I know there is a lot of questions about that but beileve me i have searched a lot and could'nt find a working solution.

thanks for all.

user2434385
  • 281
  • 1
  • 3
  • 16
  • why you hide the navigation bar? – oiledCode Nov 03 '13 at 14:06
  • http://stackoverflow.com/questions/18897485/achieving-bright-vivid-colors-for-an-ios-7-translucent-uinavigationbar?rq=1 – Neil Galiaskarov Nov 03 '13 at 14:50
  • Why color it after making it translucent? When making it translucent it takes the color of the background. If you want to have in green color just set the color to green. And by the way you don't need to hid it. – Adrian P Nov 03 '13 at 15:11

3 Answers3

1

Create a partially transparent image with the color you want the navigation bar to be and use that image as the navigation bar's background image.

Brian Shamblen
  • 4,653
  • 1
  • 23
  • 37
1

You could try this from the Apple docs: https://developer.apple.com/library/ios/samplecode/NavBar/Listings/CustomAppearance_CustomAppearanceViewController_m.html

See the applyTransparentBackgroundToTheNavigationBar method. That got me started.

Stephen Kaiser
  • 1,545
  • 14
  • 10
0

Theoretically,

self.navigationController.navigationBar.barTintColor = [UIColor greenColor];

is all you need.

Maybe change the alpha value to see if it's just not apparent enough?

Try

self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:0.0/255.0 green:255.0/255.0 blue:0.0/255.0 alpha:0.6];

Tim Chen
  • 1,364
  • 12
  • 14
  • Additionally, make sure you're up-to-date on Xcode, and on your device. A UIColor's `alpha` was ignored until iOS 7.0.3. – Aaron Brager Dec 29 '13 at 23:25