gpt4 book ai didi

ios - 使用两个栏按钮项将后退按钮添加到导航栏

转载 作者:行者123 更新时间:2023-11-28 13:11:14 26 4
gpt4 key购买 nike

我的导航栏上已经有两个栏按钮项目,但我的意图是让这两个项目在切换到另一个 View 时生成的后退按钮。

这就是我现在所拥有的(想象这两个“项目”是一个菜单按钮和一个购物车) enter image description here

这就是我想要的样子 enter image description here

谢谢!

最佳答案

尝试代码

override func viewDidLoad() { 
let hamburgerButton = UIBarButtonItem( ... )
let backButton = UIBarButtonItem(image: <#UIImage?#>, style: <#UIBarButtonItemStyle#>, target: self, action: Selector("backButtonPressed:"))
self.navigationItem.leftBarButtonItems = [hamburgerButton, backButton]
}

func backButtonPressed(sender:AnyObject) {
self.navigationController!.popViewController(true)
}

关于ios - 使用两个栏按钮项将后退按钮添加到导航栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31250085/

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