gpt4 book ai didi

ios - 无法在Pickerview中设置inputAccessoryView工具栏

转载 作者:行者123 更新时间:2023-12-01 17:37:03 25 4
gpt4 key购买 nike

在Swift 3中,我无法在pickerview中设置工具栏

pickerFilter?.inputAccessoryView = barAccessory

错误是inputAccessoryView是仅获取属性。

当我是Pickerview中的addsubview时。工具栏已显示,但完成按钮不可单击

有什么办法吗?

最佳答案

let flexiblespace = UIBarButtonItem(barButtonSystemItem:.flexibleSpace , target: nil, action: nil)

let btnDone = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(self.donePresed))
let barAccessory = UIToolbar(frame: CGRect(x: 0, y: 0, width: viewPicker.frame.size.width, height: 44))
barAccessory.barStyle = .default
barAccessory.isTranslucent = true
barAccessory.items = [flexiblespace,btnDone]

viewPicker.addSubview(pickerDrpDown!)
viewPicker.addSubview(barAccessory)

关于ios - 无法在Pickerview中设置inputAccessoryView工具栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39573388/

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