UINavigationItem titleView“如果设置了leftBarButtonItem则忽略”? [英] UINavigationItem titleView "ignored if leftBarButtonItem is set"?

查看:101
本文介绍了UINavigationItem titleView“如果设置了leftBarButtonItem则忽略”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

UINavigationItem的 titleView 属性的文档:如果 leftBarButtonItem 不是nil,则忽略此属性。

The documentation for UINavigationItem's titleView property says: "This property is ignored if leftBarButtonItem is not nil."

但是,我设置了 titleView leftBarButtonItem 我的测试中的属性,它们似乎都显示正常。我已经在我的Xcode中测试了所有模拟器:4.3,5.0和5.1。有没有人知道文档是错误的,还是在某些我无法测试的旧版本(例如4.2,3.x)上是否正确?

However, I've set both the titleView and leftBarButtonItem properties in my testing and they both appear to show up fine. I've tested on all the simulators in my Xcode: 4.3, 5.0, and 5.1. Does anyone know if the documentation is just wrong, or is it correct on some older versions (e.g. 4.2, 3.x) that I haven't been able to test?

推荐答案

检查文档的属性 leftBarButtonItems ,它说:

Check the documentation for property leftBarButtonItems, it says:


如果没有足够的空间来显示数组中的所有项目,
重叠标题视图(如果存在)或者右侧的按钮
栏不显示。

If there is not enough room to display all of the items in the array, those that would overlap the title view (if present) or the buttons on the right side of the bar are not displayed.

那么, titleView 的内容可能是不正确。

So, what's said for titleView is probably incorrect.

这篇关于UINavigationItem titleView“如果设置了leftBarButtonItem则忽略”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆