Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS, alert with no button to dismiss?

Tags:

ios

iphone

I want to present an alert window with no button on it, that means user can't close it by themselves, only the code from mine can dismiss the alert. How to implement that?

like image 206
Bin Chen Avatar asked Jun 29 '12 12:06

Bin Chen


1 Answers

UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"Hello World!"
                                                  message:@"This is sample message."
                                                 delegate:self
                                        cancelButtonTitle:nil
                                        otherButtonTitles:nil];
message.tag = 123;
[message show];
[message release]

use this to make alert with no button

To dismiss the alertview use some logic similar to this

UIAlertView *alert = (UIAlertView)[[self.view viewWithTag:123]
[alert dismissWithClickedButtonIndex:0 animated:TRUE];
like image 169
Sumanth Avatar answered Oct 15 '22 11:10

Sumanth