最終更新:2013-01-11 (金) 08:54:57 (4122d)
UIActionSheet
Top / UIActionSheet
例
例1
// アクションシート例文 UIActionSheet *as = [[UIActionSheet alloc] init]; as.delegate = self; as.title = @"選択してください。"; [as addButtonWithTitle:@"実行"]; [as addButtonWithTitle:@"中止"]; [as addButtonWithTitle:@"キャンセル"]; as.cancelButtonIndex = 2; as.destructiveButtonIndex = 0; [as showInView:self.view];
例2
UIActionSheet* actSheet = [ [ UIActionSheet alloc ] initWithTitle:@"タイトル" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"OK" otherButtonTitles:@"処理1", @"処理2", nil ];
デリゲート
- UIActionSheetDelegate?
// アクションシートのボタンが押された時に呼ばれるデリゲート例文 -(void)actionSheet:(UIActionSheet*)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { switch (buttonIndex) { case 0: // 1番目のボタンが押されたときの処理を記述する break; case 1: // 2番目のボタンが押されたときの処理を記述する break; case 2: // 3番目のボタンが押されたときの処理を記述する break; }