Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get UITextField Tap Event?

Tags:

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 its not working correctly, means not always, in case of iphone and not working in-case of iPad

- (IBAction) TopuchState {     //function code } 

please help How could I do this.

enter image description here

like image 753
Azhar Avatar asked Apr 06 '12 14:04

Azhar


People also ask

What is UITextView in Swift?

UITextView supports the display of text using custom style information and also supports text editing. You typically use a text view to display multiple lines of text, such as when displaying the body of a large text document.


1 Answers

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; } 
like image 56
Lucien Avatar answered Sep 18 '22 17:09

Lucien