how to show pickerview in uitextfield not the keyboard?

后端 未结 5 502
旧时难觅i
旧时难觅i 2021-01-31 23:38

I want to show a UIPickerView on becoming FirstResponder of a UITextfield not the keyboard and fill the value in text field form the picker view.

any one knows this?

5条回答
  •  余生分开走
    2021-01-31 23:54

    Check out the code at (there is both textview+tabbar and pickerview+tabbar code)

    UITextView and UIPickerView with its own UIToolbar

    this will get the pickerview to resign etc. All u need to do then is use the pickerview delegate method to update the text view

    - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
    

    Instead of using a textfield, use a UIlabel, with a white background. That way the keyboard will not show when you tap it. override the touches event on the UILabel, when that happens call the method form the privious question that will display the new view.

     -(void) addToViewWithAnimation:(UIView *) theView
    

提交回复
热议问题