Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide UIAlertView programmatically?

Is there a way to hide UIAlertView programmatically? Actually I have added a UITextField in UIAlertView and I want to perform the same operation as on "Ok" button press when a user hits the keyboard return key.

like image 651
Saurabh Avatar asked Oct 04 '10 09:10

Saurabh


People also ask

How do I dismiss UIAlertView programmatically?

You need to set two things. UIAlertView *alert1 = [[UIAlertView alloc]initWithTitle:@"title" message:@"message" delegate:nil cancelButtonTitle:nil otherButtonTitles:nil]; [alert1 show]; [self performSelector:@selector(dismiss:) withObject:alert1 afterDelay:1.0];

How do I dismiss an alert?

1. From the Alerts tab, under Alerts, click Inbox. 2. On the Alerts Inbox page, click the check boxes in front of the alerts you want to dismiss, then click the Dismiss button.


1 Answers

Call

[theAlertView dismissWithClickedButtonIndex:0 animated:YES]; 

when you handle the return key.

like image 116
kennytm Avatar answered Oct 12 '22 00:10

kennytm