标签:判断 ddt nat sage nbsp dex ini message action
- (void)viewDidLoad {
[super viewDidLoad];
UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem];
btn.frame = CGRectMake(40, 100, 295, 30);
[btn setTitle:@"Show Alert View" forState:UIControlStateNormal];
[btn addTarget:self action:@selector(btnClicked:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:btn];
}
- (void)btnClicked:(UIButton *)btn
{
// 实例化 UIAlertView
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"这是Title" message:@"这里是提示的信息" delegate:self cancelButtonTitle:@"取消按钮" otherButtonTitles:@"确认", nil];
// 显示UIAlertView
[alertView show];
}
// 用户点击UIAlertView上的按钮时会调用这个代理方法
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
// 通过ButtonIndex来判断用户点击的是哪一个Button
NSLog(@"%ld, %@", buttonIndex, [alertView buttonTitleAtIndex:buttonIndex]);
}
标签:判断 ddt nat sage nbsp dex ini message action
原文地址:http://www.cnblogs.com/laolitou-ping/p/6244179.html