简体   繁体   English

iOS 13 中第二个视图的导航栏按钮 alignment 错误 controller

[英]Wrong alignment of navigation bar button for second view controller in iOS 13

I am adding a button using the storyboard as below screenshot:我正在使用 storyboard 添加一个按钮,如下图所示:

在此处输入图像描述

While presenting from 1st controller to 2nd controller, navigation bar button alignment is not displaying properly.从第一个 controller 到第二个 controller 呈现时,导航栏按钮 alignment 无法正确显示。

在此处输入图像描述

I don't know whether it's iOS 13 problem or what.不知道是iOS 13问题还是什么。

To fix this issue, you need to call setNeedLayout manually in the viewWillAppear method as mentioned below:要解决此问题,您需要在 viewWillAppear 方法中手动调用 setNeedLayout,如下所述:

override func viewWillAppear(_ animated: Bool) {
     super.viewWillAppear(animated)
     if #available(iOS 13.0, *) {
          navigationController?.navigationBar.setNeedsLayout()
     }
} 

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

相关问题 iOS Push Navigation Controller,第二个视图上没有栏 - iOS Push Navigation Controller, without a bar on the second view 如何在导航栏中的按钮上设置约束? iOS 13 Swift 5(将圆形轮廓图像按钮添加到导航控制器) - How to set constraints on a button in a navigation bar? iOS 13 Swift 5 (Add circular profile image button to navigation controller) iOS ::导航栏上的按钮仅出现在根视图控制器上 - iOS::Button on navigation bar only appears on root view controller iOS 13:导航内的滚动视图 controller 不会在状态栏下 go - iOS 13: Scroll view inside navigation controller won't go under the status bar iOS状态栏-View Controller到Navigation Controller - iOS status bar - View Controller to Navigation Controller 带导航栏和视图控制器的自动布局(iOS 7) - Auto Layout with navigation bar and view controller (iOS 7) IOS:导航栏 - 重新加载视图控制器 - IOS: Navigation Bar - Reload View Controller 透明导航栏 iOS 13 - Transparent navigation bar iOS 13 iOS 13 在标签栏子视图中 controller viewWillAppear 未被调用 - iOS 13 In Tab Bar child view controller viewWillAppear is not called 按下新的视图控制器时,ios导航栏的右键按钮项将移动 - ios navigation bar right button item shifts when pushing new view controller
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM