In our application, we have a UIPickerView that allows you to select a season. However, on iOS 11, the Finish button and the Cancel button disappear and are visible only when switching between applications. Has anyone else experienced this?
Screenshots of iOS 11 behavior with iOS 10 behavior below.
Edit: here is the full sample application with the problem:
Here is the code to customize the selection view
func setUpPickerView(){
self.seasonPicker = UIPickerView.init(frame: CGRect.init(x: 0, y: 50, width: self.frame.width, height: UIScreen.main.bounds.height / 3))
self.seasonPicker.delegate = self
self.seasonPicker.dataSource = self
self.seasonTextField.inputView = self.seasonPicker
let toolbar = UIToolbar.init(frame: CGRect.init(x: 0, y: 0, width: self.frame.width, height: 50))
toolbar.barStyle = UIBarStyle.default
let labelTitle = UILabel.init(frame: CGRect.init(x: 0, y: 50, width: 150, height: 20))
labelTitle.backgroundColor = UIColor.clear
labelTitle.textColor = UIColor.black
labelTitle.textAlignment = NSTextAlignment.left
labelTitle.text = "Select a Season"
labelTitle.sizeToFit()
let typeFeild = UIBarButtonItem.init(customView: labelTitle)
let cancelButton = UIBarButtonItem.init(title: "Cancel", style: UIBarButtonItemStyle.plain, target: self, action: #selector(didClickPickerCancel))
let flexSpace = UIBarButtonItem.init(barButtonSystemItem: UIBarButtonSystemItem.flexibleSpace, target: nil, action: nil)
let doneButton = UIBarButtonItem.init(title: "Done", style: UIBarButtonItemStyle.plain, target: self, action: #selector(didClickPickerDone))
toolbar.items = [cancelButton, flexSpace, typeFeild, flexSpace, doneButton]
toolbar.sizeToFit()
self.seasonTextField.inputAccessoryView = toolbar
}

source
share