AlertViewController的使用

2016-08-24  本文已影响152人  刘振杰

UIAlertController  *alert=[UIAlertController alertControllerWithTitle:@"选择信誉度" message:nil preferredStyle:UIAlertControllerStyleActionSheet];

//设置按钮

UIAlertAction *btn2=[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {

}];

[alert addAction:btn2];

UIAlertAction *btn1=[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];

//把按钮增加到alert上

[alert addAction:btn1];

//模态弹出

[self presentViewController:alert animated:YES completion:nil];

上一篇 下一篇

猜你喜欢

热点阅读