问题
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