简体   繁体   English

导航栏中重叠的标题

[英]Overlapping titles in navigation bar

I have ViewController with a button that animated pushes second viewController to navigation stack. 我有一个带有动画的按钮的ViewController将第二个viewController推送到导航堆栈。

On that second controller I have a button with action that animated pop itself from navigation stack. 在第二个控制器上,我有一个动作按钮,动画从导航堆栈弹出。

If i repeatedly and quickly press them one by one, titles in the navigation bar will overlap each other. 如果我反复快速地逐个按下它们,导航栏中的标题将相互重叠。

Here is a screenshot of overlapped titles: 以下是重叠标题的屏幕截图:

在此输入图像描述

How can I rid of this problem? 我怎么能摆脱这个问题?

Edit: 编辑:

I have same issue, it generates randomly. 我有同样的问题,它随机生成。 I have UIViewController with UITableView , by tapping UITableViewCell it navigates to UITableViewController. 我有UIViewControllerUITableView ,通过点击UITableViewCell它导航到UITableViewController。

Sometimes UITableViewController 's title is overlapping with UIViewController 's title when I click on back button. 当我点击后退按钮时,有时UITableViewController的标题与UIViewController的标题重叠。

在此输入图像描述

NOTE: There is no custom title or custom navigation items, all controls are default controls. 注意:没有自定义标题或自定义导航项,所有控件都是默认控件。

Navigation title was set using below code: 使用以下代码设置导航标题:

self.title = @"Mail (28)";

I'm using 我正在使用

Xcode Version 8.0 (8A218a) Xcode版本8.0(8A218a)

Simulator iPhone 7 - iOS10 (14A345) 模拟器iPhone 7 - iOS10(14A345)

Inside your 1st ViewController , assign Blank String upon transition (line before you triggered the 2nd ViewController ): 在第一个ViewController ,在转换时指定空字符串(在触发第二个ViewController之前的行):

self.title = ""

And onViewWillAppear() of the 1st ViewController , reassign the 和第一个ViewController onViewWillAppear()重新分配

self.title = "previousvalue"

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

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