简体   繁体   English

带有长文本的标题视图会推动Swift 4 iOS 11导航栏后退按钮

[英]Swift 4 iOS 11 navigation bar back button is pushed by a title view with long text

For a long title on iOS 11, the back button arrow and text are not showing. 对于iOS 11上的长标题,后退按钮箭头和文本不会显示。

I searched for a solution and the closest I got was navigation bar rightbaritem image-button bug iOS 11 我搜索了一个解决方案,得到的最接近的是导航栏rightbaritem image-button bug iOS 11

It looks like this 看起来像这样
看起来很长标题
When it should look like this for long titles also 长标题也应该像这样
后退按钮应显示为简短标题
My problem though is that I don't have an explicit button added, instead the titleview pushes the "< Back" default leftBarButtonItem that I create: 我的问题是,我没有添加显式按钮,而是titleview推送了我创建的默认“ <Back” leftBarButtonItem:

navigationItem.backBarButtonItem = UIBarButtonItem(title: NSLocalizedString("Back", comment: ""), style: .plain, target: nil, action: nil)

How can I add constraints to that (UIBarButtonItem)? 如何为该(UIBarButtonItem)添加约束?

最后,我降低了titleviews文本的抗压缩性,因此长条按钮项具有更高的优先级,一切都准备就绪。

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

相关问题 推入子视图后,在导航栏中更改后退按钮文本 - Changing back button text in navigation bar after the child view is pushed in [ios]更改导航栏上后退按钮的标题 - [ios]change title of back button on navigation bar 确定显示的视图是否已被推送或来自导航栏中的后退按钮 - Determine if view that appears was pushed or came from back button in navigation bar 导航栏上的后退按钮文字太长 - Back button text too long on navigation bar 自定义标题视图作为iOS 11新导航栏中的大标题 - Custom title view as large title in iOS 11 new navigation bar iOS Swift:使用“返回”文本更新导航按钮 - IOS Swift: Update navigation button with “Back” text iOS 11,xCode 9,Swift 4导航栏按钮如果放置在视图中是否不可触摸? - iOS 11, xCode 9, Swift 4 Navigation Bar Button Not Touchable if Placed Inside a View? 将导航栏后退按钮标题重置为默认iOS - Reseting navigation bar back button title to default iOS iOS 自定义导航栏后退按钮标题在点击时消失 - iOS Custom Navigation bar back button title disappears on tapping SwiftUI 在后退按钮上显示导航栏标题但在上一个视图中不显示 - SwiftUI Show navigation bar title on the back button but not in the previous View
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM