Ravi Ravi - 5 months ago 7
iOS Question

When I tap the TextField and don't show the keyboard. How can i use?

I am new iOS Application Developer. and I want to try when i tap the

textfield
and don't show the keyboard but
textfield
to tap then show the cursor point will be show. how can i try this?
i want try this code but it did't work.

- (void)textFieldDidBeginEditing:(UITextField *)textField
{
[textField resignFirstResponder];

}

Answer

You can call the Function.

and implement the .h file.

@interface ViewController : UIViewController<UITextFieldDelegate>

implement the .m file.

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
    if (!textField.inputView) {
        //it hides the keyboard, but cursor will show
        textField.inputView = [[UIView alloc] initWithFrame:CGRectZero];
    }
    return YES;
}

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
    return NO;
}
Comments