ios - 将导航栏后退按钮标题重置为默认 iOS
<p><p>我知道我可以设置导航栏后退按钮的标题:</p>
<pre><code>self.navigationItem.backBarButtonItem = UIBarButtonItem(title:"", style:.plain, target:nil, action:nil)
</code></pre>
<p>但是,我的应用程序的某些部分<strong>我想将其设置回默认文本“返回”(也将使用本地化)</strong>。我该怎么做呢?</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>当我在父 ViewController 中调用 <code>pushViewController</code> 之后立即放置它时,这个小技巧似乎起作用了。</p>
<p>然而,我在 iPad Pro 模拟器上的测试表明,它不仅试图显示缩写文本,而且后退按钮甚至会覆盖任何打算出现在右侧的 <code>UIButtonBarItem</code>。 </p>
<pre class="lang-swift prettyprint-override"><code>let backButtonItem = UIBarButtonItem()
backButtonItem.title = "A button title which is much too long to be displayed in the navigation bar, so that iOS will replace this text with localized 'Back' button text."
navigationItem.backBarButtonItem = backButtonItem
</code></pre></p>
<p style="font-size: 20px;">关于ios - 将导航栏后退按钮标题重置为默认 iOS,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/39887978/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/39887978/
</a>
</p>
页:
[1]