How to get UITextField Tap Event?

后端 未结 5 1123
既然无缘
既然无缘 2020-12-18 18:42

I am trying to show UIAlertView on Tap or Click of UITextField for both IPad and IPhone. I make an IBAction and Attach it with Tap Down event of UITextField.

But it

5条回答
  •  粉色の甜心
    2020-12-18 19:02

    As you are already subscribed to be UITextField delegate, implement this method:

    - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
    
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Alert" message:@"Alert Message" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Ok", nil];
        [alert show];
    
        return YES;
    }
    

提交回复
热议问题