下面是动作和警报视图。为什么当用户点击按钮时这不起作用?
警报/行动
-(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
}
}