PickerView 移除占位符标签 swift
PickerView Remove Placeholder label swift
有什么方法可以从下面给出的 UIPickerView
屏幕截图顶部删除 Select
字符串:
代码:
var pickerVWUserList = UIPickerView()
//MARK:- Setup Picker View For TextField
func setupForPickerViewForTxtFld() {
pickerVWUserList.delegate = self
pickerVWUserList.dataSource = self
txtfldAllGroup.inputView = pickerVWUserList
}
//MARK:- Extension for picker View
extension VC:UIPickerViewDataSource,UIPickerViewDelegate {
func numberOfComponents(in pickerView: UIPickerView) -> Int {
return 1
}
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return listOfAllTypesGroups.count
}
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
return listOfAllTypesGroups[row].groupName
}
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
slctedGroupId = listOfAllTypesGroups[row].groupId
}
谢谢
在 AppDelegate didFinishLaunchingWithOptions 中尝试此代码
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
IQKeyboardManager.shared.enable = true
IQKeyboardManager.shared.shouldShowToolbarPlaceholder = false
return true
}
有什么方法可以从下面给出的 UIPickerView
屏幕截图顶部删除 Select
字符串:
代码:
var pickerVWUserList = UIPickerView()
//MARK:- Setup Picker View For TextField
func setupForPickerViewForTxtFld() {
pickerVWUserList.delegate = self
pickerVWUserList.dataSource = self
txtfldAllGroup.inputView = pickerVWUserList
}
//MARK:- Extension for picker View
extension VC:UIPickerViewDataSource,UIPickerViewDelegate {
func numberOfComponents(in pickerView: UIPickerView) -> Int {
return 1
}
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return listOfAllTypesGroups.count
}
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
return listOfAllTypesGroups[row].groupName
}
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
slctedGroupId = listOfAllTypesGroups[row].groupId
}
谢谢
在 AppDelegate didFinishLaunchingWithOptions 中尝试此代码
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
IQKeyboardManager.shared.enable = true
IQKeyboardManager.shared.shouldShowToolbarPlaceholder = false
return true
}