AlertViewController的使用

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];

你可能感兴趣的:(AlertViewController的使用)