首页 > 其他 > 详细

UIAlertView笔记

时间:2014-12-22 12:40:22      阅读:246      评论:0      收藏:0      [点我收藏+]

 

头文件: 

@interface MyAlertViewViewController : UIViewController<UIAlertViewDelegate> { 

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex; 

-(IBAction) buttonPressed; 

@end


源文件: 

-(IBAction) buttonPressed 

UIAlertView*alert = [[UIAlertView alloc]initWithTitle:@"提示" 

message:@"请选择一个按钮:" 

delegate:self 

cancelButtonTitle:@"取消" 

otherButtonTitles:@"按钮一", @"按钮二", @"按钮三",nil]; 

[alert show];

}  

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex 

{

NSString* msg = [[NSString alloc] initWithFormat:@"您按下的第%d个按钮!",buttonIndex]; 

UIAlertView* alert = [[UIAlertView alloc]initWithTitle:@"提示" 

message:msg 

delegate:nil 

cancelButtonTitle:@"确定" 

otherButtonTitles:nil];  

[alert show]; 

}

UIAlertView笔记

原文:http://www.cnblogs.com/progfun/p/4177785.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!