以编程方式解雇UIAlertView [英] dismissing a UIAlertView programmatically
本文介绍了以编程方式解雇UIAlertView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要帮助以编程方式解雇UIAlertView。目前我有这个
I need help on dismissing a UIAlertView programmatically. Currently I have this
UIAlertView * alert1 = [[UIAlertView alloc] initWithTitle:@title消息:@messagedelegate:nil cancelButtonTitle :nil otherButtonTitles:nil];
然后我称之为
[alert1 dismissWithClickedButtonIndex:0 animated:NO];
但没有任何反应。
推荐答案
你需要设置两件事。
1。包括你的.h文件: < UIAlertViewDelegate>
2。请按照以下实施方式...
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];
解雇方法将是......
-(void)dismiss:(UIAlertView*)alert
{
[alert dismissWithClickedButtonIndex:0 animated:YES];
}
我希望这会对你有帮助。
I hope this will help you.
这篇关于以编程方式解雇UIAlertView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文