I've came across a few tutorials on how to customize the navigation bar on the iPhone. Apparently some of the methods used are not approved by Apple, anybody has an app approved that was using a custom navigation bar and if so how did you do it? Thank you.
Asked
Active
Viewed 588 times
0
-
How do you want to customize the navigation bar? – Chaitanya Gupta Aug 24 '11 at 20:27
-
Hello, I want to add an image. – Shawn Black Aug 24 '11 at 21:32
1 Answers
0
In iOS 5, you can easily set an image into your NavigationBar by calling:
[navigationBar setBackgroundImage:[UIImage imageNamed:@"navbar.png"] forBarMetrics:UIBarMetricsDefault];
Before iOS 5, there is no public API to do so. You have to do it by yourself, and all of those ways are going to be in trouble in iOS 5 because the NavigationBar has changed a lot in the new iOS.
P.S. Maybe I should not talk about iOS 5 things here because it is not released yet and still under Apple's NDA...

xuzhe
- 5,100
- 22
- 28
-
ok but do you know a way i could implement it for now and when IOS 5 gets released we will update it? – Shawn Black Aug 25 '11 at 07:58
-
By implementing this on my app delegate it works fine but is Apple gonna approve it? – Shawn Black Aug 25 '11 at 08:22
-
This is iOS 5 feature, but you can still use this code for iOS 4 by check `[navigationBar respondsToSelect:@selector(setBackgroundImage:forBarMetrics:)]` before you use it. And the code will be automatically enabled in iOS 5 without any code modify needed. – xuzhe Aug 26 '11 at 04:23
-
It's good to know it works. If you think this answer is helpful, select it as correct answer would very appreciate. – xuzhe Aug 26 '11 at 19:50
-
Sure, quick question i'm trying to add a static image on top of a UITableView(not inside the cell) do you know how could i do that, just a static image on the view. – Shawn Black Aug 26 '11 at 20:00
-
Maybe you can make a UIImageView with your static image, and set it as UITableView's `tableHeaderView` – xuzhe Aug 26 '11 at 20:09
-
`tableView.tableHeaderView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"staticImage.png"]] autorelease];` for example. – xuzhe Aug 27 '11 at 11:16