简体   繁体   English

iOS,没有按钮解除警报?

[英]iOS, alert with no button to dismiss?

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? 如何实现?

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 要关闭alertview,请使用与此类似的逻辑

UIAlertView *alert = (UIAlertView)[[self.view viewWithTag:123]
[alert dismissWithClickedButtonIndex:0 animated:TRUE];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM