Hatena::Groupiphone-dev

func09の日記

 | 

2008-12-03

UIAlertView

18:23

UIAlertViewを使うサンプル

UIAlertView *alertView = [[UIAlertView alloc] 
  initWithTitle:@"title"
  message:@"message"
  delegate:self
  cancelButtonTitle:@"Cancel"
  otherButtonTitles:@"OK",nil];
[alertView show];
[alertView release];

最後のnilがよくわかんないけど、無いとハングする。

以下はデリゲートメソッド。オプション

#pragma mark - UIAlertViewDelegate Protocol
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{}
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex{}
- (void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex{}
- (void)alertViewCancel:(UIAlertView *)alertView{}
- (void)didPresentAlertView:(UIAlertView *)alertView{}
– didPresentAlertView:{}
 |