UINavigationItem titleView quot;ignored if leftBarButtonItem is setquot;?(UINavigationItem titleView“如果设置了leftBarButtonItem则忽略?)
问题描述
UINavigationItem 的 titleView 属性文档 说:
The documentation for UINavigationItem's titleView property says:
如果 leftBarButtonItem 不为零,则忽略此属性."
"This property is ignored if
leftBarButtonItemis 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则忽略"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:UINavigationItem titleView“如果设置了leftBarButtonItem则忽略"?
基础教程推荐
- SwiftUI-ScrollViewReader的ScrollTo不滚动 2022-01-01
- iOS - UINavigationController 添加多个正确的项目? 2022-01-01
- 如何比较两个 NSDate:哪个是最近的? 2022-01-01
- 为什么姜饼模拟器方向卡在应用程序中? 2022-01-01
- Android Volley - 如何动画图像加载? 2022-01-01
- UIImage 在开始时不适合 UIScrollView 2022-01-01
- Play 商店的设备兼容性问题 2022-01-01
- navigationItem.backBarButtonItem 不工作?为什么上一个菜单仍然显示为按钮? 2022-01-01
- 如何将图像从一项活动发送到另一项活动? 2022-01-01
- Xcode UIView.init(frame:) 只能在主线程中使用 2022-01-01
