// 기본
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Hello World"
message:@"iphone, here I come!"
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
////사용자가 버튼 누를때까지 대기
UIAlertView *alert =[[UIAlertView alloc] initWithTitle:@"Contacting Server\nPlease Wait..."
message:nil
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
while ((!alert.hidden) && (alert.superview != nil)) {
[[NSRunLoop currentRunLoop] limitDateForMode:NSDefaultRunLoopMode];
}
[alert release];
////Macro
#define ALERT(X,Y) {UIAlertView *alert = [[UIAlertView alloc] initWithTitle:X message:Y delegate:self cancelButtonTitle:@"OK"otherButtonTitles: nil];[alert show];[alert release];}
//// Yes/No alert view
- (IBAction)deleteBtn:(id)sender {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"削除"
message:@"削除しますか?"
delegate:self
cancelButtonTitle:@"はい"
otherButtonTitles:@"いいえ", nil];
[alert show];
[alert release];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
NSLog(@"%d", buttonIndex);
}