alertDialog示例

来源:互联网 发布:数据输入 编辑:程序博客网 时间:2024/05/17 07:58
  1. UIAlertController* alert=[UIAlertController alertControllerWithTitle:@"提示"
  2. message:@"是否要重新开始?"
  3. preferredStyle:UIAlertControllerStyleAlert];
  4. UIAlertAction* defaultAction=[UIAlertAction actionWithTitle:@"是" style:UIAlertActionStyleDefault
  5. handler:^(UIAlertAction* action){
  6. self.timeLabel.text=@"5";
  7. }];
  8. UIAlertAction*Action1=[UIAlertAction actionWithTitle:@"取消"
  9. style:UIAlertActionStyleCancel
  10. handler:^(UIAlertAction*action){
  11. }];
  12. [alert addAction:defaultAction];
  13. [alert addAction:Action1];
  14. [self presentViewController:alert animated:YES completion:nil];
0 0
原创粉丝点击