gpt4 book ai didi

swift - 后退按钮中的单个空格不会更改图标 Xcode 项目

转载 作者:搜寻专家 更新时间:2023-11-01 06:55:21 25 4
gpt4 key购买 nike

我有一个带有标题的 Xcode 项目,我想将它的图标从文本更改为左箭头,我在 navigationBar 后退按钮文本中写了一个空格,但是图标只是消失了它不会将其更改为左侧图标如我所愿

我做错了什么?

这是我在更改之前的内容:

enter image description here

这是我想要实现的目标:

enter image description here

我将标题文本更改为一个空格,我知道应该将其更改为一个箭头:

enter image description here

enter image description here

但结果仍然只是空标题

enter image description here

这是我的层次结构

enter image description here

我做错了什么?以及如何更改图标?

最佳答案

如果您不希望文本作为导航栏中的后退按钮,您应该对前一个 Controller 的 UINavigationItembackBarButtonItem 进行操作。

Apple 文档指定:

The backBarButtonItem property of a navigation item reflects the back button you want displayed when the current view controller is just below the topmost view controller. In other words, the back button is not used when the current view controller is topmost.

默认值为nil,如果设置为单个空格""则只显示返回图标。

在您的情况下,您使用的是 Storyboard文件,因此您可以在文档大纲中找到与 Controller View 相同级别的 UINavigationItem。

关于swift - 后退按钮中的单个空格不会更改图标 Xcode 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53848135/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com