Skip to content

Instantly share code, notes, and snippets.

@akitsukada
Created June 17, 2014 17:29
Show Gist options
  • Save akitsukada/e597feeb40ba3bbe8992 to your computer and use it in GitHub Desktop.
Save akitsukada/e597feeb40ba3bbe8992 to your computer and use it in GitHub Desktop.
@interface MyClass() <UIAlertViewDelegate>
@end
@implementation MyClass
- (void) hoge
{
UIAlertView *alert = [[UIAlertView alloc] init];
alert.delegate = self;
alert.title = @"タイトル";
alert.message = @"メッセージ";
[alert addButtonWithTitle:@"OK"];
[alert addButtonWithTitle:@"CANCEL"];
alert.cancelButtonIndex = 1;
[alert show];
}
-(void)alertView:(UIAlertView*)alertView
clickedButtonAtIndex:(NSInteger)buttonIndex
{
switch (buttonIndex) {
case 0:
NSLog(@"OK");
break;
case 1:
NSLog(@"CANCEL");
break;
}
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment