iphone app で警告を利用する
wwdc2011が今日からですね。ios5の発表っもあるとか..
ただ、まだまだそんなレベルでないので、地道に少しずつ。
iphoneアプリで警告を表示したい場合。
clickedButtonAtIndex
- (IBAction) refreshAll{ NSLog(@"refreshAll%@",@"_in"); // 1行で書くタイプ(複数ボタンタイプ) UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Refresh" message:@"clear your result?" delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil]; [alert show]; NSLog(@"refreshAll%@",@"_out"); } - (void)alertView:(UIAlertView*)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { NSLog(@"clickedButtonAtIndex%@",@"_in"); if (buttonIndex == 1) { aveMph = 0; aveKmh = 0; counter = 0; [results removeAllObjects]; [self showCounters]; } [alertView release]; NSLog(@"clickedButtonAtIndex%@",@"_out"); }
buttonIndexは左から0,1,2となるそう。
おしまい。