Reputation: 23
I am using uipickerview in textfield. When I click on any text Field an uipickerview will display, and we can select any value from uipickerview.
So, my problem is that. When I click on textfield uipicker will come as well as in text field editing mode is showing.
so, when i clicked on HelpTopics text field, picker is coming as well as it showing editing mode in textfield. How solve it. I mean, i do not want that editing option mode. When i click on textfield only picker will be show, this is I want. How to do it ?
Upvotes: 0
Views: 138
Reputation: 942
Swift 3+: Use this UITextFieldDelegate Method. Just write these line.
func textFieldDidBeginEditing(_ textField: UITextField) {
if textField == yourTextField{
textField.resignFirstResponder()
// Open your picker here.
}
}
Upvotes: 0
Reputation: 6082
Just write one line
Swift
yourTextFieldObject.tintColor = .clear // "yourTextFieldObject" is "HelpTopics" textField's object
Objective-C
yourTextFieldObject.tintColor = [UIColor clearColor]; // "yourTextFieldObject" is "HelpTopics" textField's object
But above code your textField cursor color will be clear and will not be display.
Upvotes: 2