user6417700
user6417700

Reputation:

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];

}

Upvotes: 1

Views: 73

Answers (2)

Ravi Dhorajiya
Ravi Dhorajiya

Reputation: 1531

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;
}

Upvotes: 1

Martin Le
Martin Le

Reputation: 719

If you don't allow people to tap in TextField, using textfield's delegate method:

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

Upvotes: 0

Related Questions