您的位置:首页 > 产品设计 > UI/UE

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

2016-08-05 17:49 405 查看
- (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];
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐