顯示具有 Xcode6 標籤的文章。 顯示所有文章
顯示具有 Xcode6 標籤的文章。 顯示所有文章

2014年9月24日 星期三

Xcode 6.0.1 / iOS 8 UIAlertController

UIAlertControllerStyleAlert with Buttons

UIAlertController  *alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleAlert];
   
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel"
style:UIAlertActionStyleCancel
handler:^(UIAlertAction *action)
{
NSLog(@"Cancel Action");
        }];
   
UIAlertAction *deleteAction = [UIAlertAction actionWithTitle:@"Delete"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action)
{
NSLog(@"Delete Action");
}];

[alertController addAction:cancelAction];
[alertController addAction:deleteAction];

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