标签:
- (void)viewDidLoad {
[super viewDidLoad];
UIButton *btn=[UIButton buttonWithType:UIButtonTypeCustom];
btn.frame=CGRectMake(10, 60, 80, 30);
[btn setTitle:@"提示框" forState:UIControlStateNormal];
btn.backgroundColor=[UIColor redColor];
[btn addTarget:self action:@selector(gotoAlertVC) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:btn];
}
-(void)gotoAlertVC{
UIAlertController *alertVC=[UIAlertController alertControllerWithTitle:@"提示信息" message:@"iOSQQ技术交流群436337987" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *sureAction=[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
NSLog(@"确定加入");
}];
UIAlertAction *cancelAction=[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
NSLog(@"取消加入");
}];
[alertVC addAction:sureAction];
[alertVC addAction:cancelAction];
[self presentViewController:alertVC animated:YES completion:nil];
}
标签:
原文地址:http://www.cnblogs.com/shao621/p/5112753.html