Combobox component for Swift (failed with DownPicker)

﹥>﹥吖頭↗ 提交于 2019-12-07 19:13:57

问题


I need a component like comboBox when it dropes down and allow user to select value. PickerView looks terrible and one I found nice looking was DownPicker

I followed instructions, installed it and tried to use but I did not see the data I pass to this component in it.

let data = NSMutableArray()
        data.addObject("1")
        data.addObject("2")
        data.addObject("3")

        let a = DownPicker(textField: group!, withData: data)

Also nothing happens when I tap down arrow icon

Just advice me another components like this one which will work correctly with xcode 7 beta 6 or help me to fix problems with current try. Thanks)

Update: I've just tried this one. Nothing good from it too :\


回答1:


DownPicker is working fine with Swift. I just tried it and use it in my project. The problem I see is that you init DownPicker to local variable. There are two ways how you can use DownPicker in your project and it looks you choose Control Wrapper. So you should have in your controller these controls:

@IBOutlet weak var personTextField: UITextField!
var personDownPicker: DownPicker!

The first one is outlet connected to UITextField added in storyboard. DownPicker I Initialized in viewDidLoad:

override func viewDidLoad() {
        super.viewDidLoad()

        let persons: NSMutableArray = ["Architect", "Designer"]
        self.personDownPicker = DownPicker(textField: self.personTextField, withData:persons)
}  


来源:https://stackoverflow.com/questions/32427823/combobox-component-for-swift-failed-with-downpicker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!