Custom View in tab bar does no longer work in iOS6

2019-05-25 19:40发布

问题:

I have a custom View (UILabel + UIImage) which I use as the custom view of my UINavigationController which I set like so:

self.navigationItem.titleView = self.myTitleLabel;

This works fine in iOS 5 but ceases to work under iOS 6. Although the value is set in the debugger, it does not show at all.

Update: As mark pointed out the docs states the following:

If this property value is nil, the navigation item’s title is displayed in the center of the navigation bar when the receiver is the top item. If you set this property to a custom title, it is displayed instead of the title. This property is ignored if leftBarButtonItem is not nil.

Now I have a backButton and not an "explicit" leftBarButtonItem. But what if you want your Logo in the Navigation Bar and still have a Back button or a bar on the left?

回答1:

I've used this way before but it seems me like some workaround. I advice you to use your own UIToolBar and hide navigation bar. It's simple. The only what you need is to get image for Back button here http://www.teehanlax.com/downloads/ios-5-gui-psd-iphone-4s/.