1.初始化警示框
UIAlertController *alertController=[UIAlertController alertControllerWithTitle:@"友情提示" message:@"你最帅" preferredStyle:UIAlertControllerStyleActionSheet];
//UIAlertControllerStyleAlert是从中间弹出来,字是黑色的
//UIAlertControllerStyleActionSheet,底部弹出来,字体是灰色的
2.初始化一个按钮
UIAlertAction *action=[UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
NSLog(@"wo");
}];
3.添加按钮
[alertController addAction:action];
4.显示警示框
[self presentViewController:alertController animated:YES completion:nil];