I would like to change a label, while the value of a picker view was changed.
The problem is that I can not create an action by dropping the picker view to the code. Is this impossible?
With my datepicker, I can do it like that:
@IBAction func ChangeDatePicker(sender: AnyObject) {
var dateFormatter = NSDateFormatter()
dateFormatter.dateStyle = NSDateFormatterStyle.MediumStyle
dateFormatter.dateFormat = "HH:mm"
var strDate = dateFormatter.stringFromDate(DatePicker.date)
DateLabel.text = "\(strDate) Uhr"
}
func pickerView(pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
print(myPickerViewData[row])
}
Tutorial here: http://makeapppie.com/tag/uipickerview-in-swift/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With