IOS开发之 ---- iOS8中提示框的使用UIAlertController(UIAlertView和UIActionSheet二合一)

来源:互联网 发布:excel调用单元格数据 编辑:程序博客网 时间:2024/05/16 05:01
- (void)showOkayCancelAlert {    NSString *title = NSLocalizedString(@"A Short Title Is Best", nil);    NSString *message = NSLocalizedString(@"A message should be a short, complete sentence.", nil);    NSString *cancelButtonTitle = NSLocalizedString(@"Cancel", nil);    NSString *otherButtonTitle = NSLocalizedString(@"OK", nil);    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];        // Create the actions.    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:cancelButtonTitle style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {        NSLog(@"The \"Okay/Cancel\" alert's cancel action occured.");    }];        UIAlertAction *otherAction = [UIAlertAction actionWithTitle:otherButtonTitle style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {        NSLog(@"The \"Okay/Cancel\" alert's other action occured.");    }];        // Add the actions.    [alertController addAction:cancelAction];    [alertController addAction:otherAction];        [self presentViewController:alertController animated:YES completion:nil];}
0 0
原创粉丝点击