I updated my project to Swift
4 XCode
9
I have a InputText whit a input view using a Picker
I added a UIToolBar
at InputText.
It was working well before upgrade.
now it's like the UIPickerView
it's over the UIToolBar
.
I can see but if i click on it's like I click on UIPickerView
The UIToolBar
it's perfectly working, because if i set the toolbar to a normal TextInput it appear and work well..
What can be?
Here is my code:
var picker: UIPickerView
picker = UIPickerView(frame: CGRect(x: 0, y: 200, width: view.frame.width, height: 300))
picker.backgroundColor = .white
picker.showsSelectionIndicator = true
picker.delegate = self
picker.dataSource = PickerData as? UIPickerViewDataSource
textField.inputView = picker
let toolBar = UIToolbar()
toolBar.barStyle = UIBarStyle.default
toolBar.isTranslucent = true
toolBar.tintColor = .blue
toolBar.sizeToFit()
let doneButton = UIBarButtonItem(title: "Seleziona", style: UIBarButtonItemStyle.plain, target: self, action: #selector(self.doneFunction(_:)))
let spaceButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.flexibleSpace, target: nil, action: nil)
let cancelButton = UIBarButtonItem(title: "Annulla", style: UIBarButtonItemStyle.plain, target: self, action: #selector(self.doneFunction(_:)))
toolBar.setItems([cancelButton, spaceButton, doneButton], animated: false)
toolBar.isUserInteractionEnabled = true
textField.inputAccessoryView = toolBar
I tried also with picker.addSubview(toolBar)
but whit same result.