gpt4 book ai didi

ios - "Missing argument for parameter ' 样式' in call"创建系统UIBarButtonItem 错误

转载 作者:搜寻专家 更新时间:2023-10-30 23:00:35 27 4
gpt4 key购买 nike

我不明白为什么编译器要求在这个系统风格的 UIBarButtonItem 初始值设定项中为样式参数提供参数——它首先没有那个参数。帮助?这是 Swift 的错误吗?

class ExpensesViewController: UIViewController {

lazy var newExpenseBarButtonItem = UIBarButtonItem(barButtonSystemItem: .Add, target: self, action: Selector("newExpenseBarButtonItemTapped:"))

func newExpenseBarButtonItemTapped() {

}

}

最佳答案

这将删除编译器错误消息:

class ExpensesViewController: UIViewController {

lazy var newExpenseBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.UIBarButtonSystemItemAdd.value,
target:self, action:Selector("newExpenseBarButtonItemTapped:"))

func newExpenseBarButtonItemTapped() {

}

}

.Add 不是有效值

关于ios - "Missing argument for parameter ' 样式' in call"创建系统UIBarButtonItem 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25564292/

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