Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

moonman239

Cancelled
Original poster
Mar 27, 2009
1,541
32
I want to know how to make the UINavigationBar translucent.
Code:
[[UINavigationBar appearance] setOpaque:FALSE];
caused an exception to be thrown, which caused the app to be terminated. I'm also using a background image. I suppose I'll need a translucent image as well.

Thanks for your help!
 

idelovski

macrumors regular
Sep 11, 2008
235
0
Instead of opaque I think you should use translucent property.

I know that all the things I do on the navigation bars come down to these properties: -barStyle, -translucent and -alpha.
 

moonman239

Cancelled
Original poster
Mar 27, 2009
1,541
32
Please post the exception's stack dump (symbolicated).

Instead of opaque I think you should use translucent property.

I know that all the things I do on the navigation bars come down to these properties: -barStyle, -translucent and -alpha.

Here's the output after trying what idelovski suggested:

Code:
2012-06-21 09:56:56.602 CleanCuisine[4692:10103] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** Illegal property type, c in invocation selector, _UIAppearance_setTranslucent:'
*** First throw call stack:
(0x1870d72 0x1067e51 0x1870b4b 0x43d060 0x438cdc 0x4390d5 0x5c658 0x90042 0x5cb77 0x581cb 0x5e482 0x56ad2 0x4231d 0x424f6 0x4268c 0x4a871 0x11a90 0x1296a 0x232be 0x23f9f 0x163fd 0x17cdf39 0x17cdc10 0x17e6da5 0x17e6b12 0x1817b46 0x1816ed4 0x1816dab 0x1228f 0x13e71 0x1ddd 0x1d05)
libc++abi.dylib: terminate called throwing an exception
(lldb)
 

moonman239

Cancelled
Original poster
Mar 27, 2009
1,541
32
Update: I tried putting the following code into ViewController.m, but to no avail.

Code:
self.navigationController.navigationBar.translucent = YES;

Xcode throws no errors, but it just doesn't work.

Edit: Should the image be translucent?

I have to wonder: Why does Xcode make a seemingly simple task as hard as it is? I shouldn't have to touch the code just to do this! I should be able to do it in the GUI editor! :mad:
 

idelovski

macrumors regular
Sep 11, 2008
235
0
Then it looks a s if the translucent property is just the flag Apple uses when they draw their image or whatever they do to draw the bar. In your case, you need to supply such image or use alpha property. Try .66f for alpha or something like that.

EDIT:

And subviews are laid out differently if navbar is translucent. TableViews scroll cells under the navbar if it's translucent (and under status bar too if it is translucent).
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.