How to disable keyboard appearing when hitting on a text field , iOS?

-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
    // Here You can do additional code or task instead of writing with keyboard
    return NO;
}

this delegate method will get called first when you hit to textfield and if you write NO as a boolean value means you dont want to begin editing so it will not present Keyboard.


- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
    if(textfield == yourtextField)
    {
        [textfield resignFirstResponder];
        // Show you custom picker here....
        return NO;
    }     
}

and you need to implement the uitextfielddelegate in the controller.

and give assign the delegate to yourtextField.


Use textfield delegate.

-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{        
    return NO;
}