Skip to content

Instantly share code, notes, and snippets.

@kmdsbng
Created October 12, 2013 14:50
Show Gist options
  • Select an option

  • Save kmdsbng/6950779 to your computer and use it in GitHub Desktop.

Select an option

Save kmdsbng/6950779 to your computer and use it in GitHub Desktop.
alertView表示&コールバック
- (IBAction)showAlert:(UIButton *)sender {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"タイトル"
message:@"本文"
delegate:self
cancelButtonTitle:@"キャンセル"
otherButtonTitles:@"OK", nil];
[alertView show];
NSLog(@"%@", @"アラート押された");
}
- (void)alertView:(UIAlertView *)alertView
clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSLog(@"%@", @"閉じた");
if(buttonIndex == 0) {
NSLog(@"%@", @"キャンセル");
} else if(buttonIndex == 1){
NSLog(@"%@", @"OK");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment