大佬教程收集整理的这篇文章主要介绍了在iphone sdk 4.3中单击按钮的警报消息,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我的守则如下,
- (IBACtion)buttonPressed:(id)sender{ UIAlertView* mes=[[UIAlertView alloc] initWithtitle:@"Hello World!!!!!!" message:@"This is the Iphone app" delegate:self cancelButtontitle:@"Ok" otherButtontitles: nil]; [mes show]; [mes release];
请帮我解决这个问题.
-(IBACtion)buttonOnePressed:(id)sender { UIAlertView *alert = [[UIAlertView alloc]initWithtitle: @"Clicked button 1" message: @"Alert message here" delegate: self cancelButtontitle:@"Cancel" otherButtontitles:@"OK",nil]; [alert setTag:1]; [alert show]; } -(IBACtion)buttonTwoPressed:(id)sender { UIAlertView *alert = [[UIAlertView alloc]initWithtitle: @"Clicked button 2" message: @"Alert message here" delegate: self cancelButtontitle:@"Cancel" otherButtontitles:@"OK",nil]; [alert setTag:2]; [alert show]; }
下面是跟踪Alertview上的哪个按钮的委托方法.
-(void)alertView:(UIAlertView *)alertView clickedButtonATindex:(NSInteger)buttonIndex { if (alertView.tag == 1) { // UIAlertView with tag 1 detected if (buttonIndex == 0) { NSLog(@"user pressed Button Indexed 0"); // Any action can be performed here } else { NSLog(@"user pressed Button Indexed 1"); // Any action can be performed here } } else if (alertView.tag == 2) { // UIAlertView with tag 2 detected if (buttonIndex == 0) { NSLog(@"user pressed Button Indexed 0"); // Any action can be performed here } else { NSLog(@"user pressed Button Indexed 1"); // Any action can be performed here } } }
如果您有多个UIAlertViews,可以将标记设置为UIAlertView,并且可以使用其各自的标记确定在其委托方法clickedButtonATindex中单击了哪个UIAlertView按钮.
以上是大佬教程为你收集整理的在iphone sdk 4.3中单击按钮的警报消息全部内容,希望文章能够帮你解决在iphone sdk 4.3中单击按钮的警报消息所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。