应该raise.in选择器视图我又增加了这样在文本框点击pickerview改变文本框输入视图从pickerview到键盘在SWIFT 3.0
picker.delegate = self
picker.dataSource = self
picker.showsSelectionIndicator = true
let toolBar = UIToolbar()
toolBar.barStyle = UIBarStyle.default
toolBar.isTranslucent = true
toolBar.tintColor = UIColor.black
//UIColor(red: 76/255, green: 217/255, blue: 100/255, alpha: 1)
toolBar.sizeToFit()
let addbutton = UIBarButtonItem(title: "+Add", style: UIBarButtonItemStyle.plain, target: self, action: #selector(GBEDasboardViewController.addproducts))
let spaceButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.flexibleSpace, target: nil, action: nil)
let cancelButton = UIBarButtonItem(title: "Cancel", style: UIBarButtonItemStyle.plain, target: self, action: #selector(GBEDasboardViewController.addproducts))
toolBar.setItems([cancelButton, spaceButton, doneButton], animated: false)
toolBar.isUserInteractionEnabled = true
productname.inputView = picker
productname.inputAccessoryView = toolBar
上点击Add按钮pickerview工具应该关闭和键盘应提高
func addproducts(){
self.view.endEditing(true)
}
pickerview正在关闭,但如何提高键盘。
你想在同一个文本框的键盘和选择器? –
是初始选择器视图点击添加选择器视图然后我应该得到键盘为同一个文本框 –