简体   繁体   English

RightBarButton在iOS 11中降低了横向方向

[英]RightBarButton lowered in landscape-orientation in iOS 11

I have a problem with the RightBarButton within an iOS-App. 我在iOS应用程序中的RightBarButton遇到问题。 Whenever the device is rotated to landscape, that button lowers as seen in the screenshot. 只要将设备旋转到横向,该按钮就会降低,如屏幕截图所示。 While in portrait-orientation everything looks fine. 在纵向模式下,一切看起来都很好。

Any ideas? 有任何想法吗?

屏幕截图

调试视图层次结构

try to check the hierarchy view. 尝试检查层次结构视图。 I surpose RightBarButton's frame didn't work 我想RightBarButton的框架不起作用

I still have no idea what caused the misplaced label on orientation-change, but I was able to solve it by using a custom UIButton as my UIBarButtonItem: 我仍然不知道是什么原因导致方向改变时标签放错了地方,但是我可以通过使用自定义UIButton作为我的UIBarButtonItem解决它:

let rightButton: UIButton = UIButton(type: .system)
[...]
let rightBarButtonItem: UIBarButtonItem = UIBarButtonItem(customView: rightButton)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM