标签栏中的自定义视图在iOS6中不再有效 [英] Custom View in tab bar does no longer work in iOS6
问题描述
我有一个自定义视图( UILabel
+ UIImage
),我将其用作<$的自定义视图c $ c> UINavigationController 我这样设置:
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;
这在iOS 5中运行良好但在iOS 6下停止运行。虽然该值设置在调试器,它根本不显示。
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:
如果此属性值为
nil
,则当导航栏的标题显示在导航栏的中心时接收器是最重要的项目。如果将此属性设置为自定义标题,则会显示该属性而不是标题。如果leftBarButtonItem
不是nil
,则忽略此属性。
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 ifleftBarButtonItem
is notnil
.
现在我有一个 backButton
而不是显式 leftBarButtonItem
。但是如果你想在导航栏中使用你的Logo并且左边还有一个后退按钮或一个栏呢?
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?
推荐答案
我以前用过这种方式,但似乎我喜欢一些解决方法。我建议你使用自己的UIToolBar并隐藏导航栏。这很简单。您唯一需要的是在此处获取返回按钮的图像 http ://www.teehanlax.com/downloads/ios-5-gui-psd-iphone-4s/ 。
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/.
这篇关于标签栏中的自定义视图在iOS6中不再有效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!