【发布时间】:2013-06-24 15:45:50
【问题描述】:
下面是动作和警报视图。为什么当用户点击按钮时这不起作用?
警报/行动
-(IBAction)myButton
{
UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"" message:@"Call (804) 378-7120?"
delegate:self cancelButtonTitle:@"NO" otherButtonTitles:@"YES",nil];
[alert show];
[alert release];
}
如何处理用户输入
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if(buttonIndex==1)
{
[[UIApplication sharedApplication]
openURL:[NSURL URLWithString:@"tel://(804) 378-7120"]];
}
else
{
//Do whatever you want
}
}
【问题讨论】:
-
你的班级是否在标题中声明了
UIAlertViewDelegate?