2

iPhone では、カレンダー アプリで [イベントの削除] ボタンを押すと、確認が下からスライドして表示されます。誰かがこれのサンプルコードを知っていますか、それともカスタム背景でモーダルに表示された短いビューですか?

これがカスタム ビューを使用して作成されている場合、カレンダー アプリで使用されているものと同じ背景グラフィックをどこで入手できるか知っていますか?

前もって感謝します!

注意: 私は UIAlertView ダイアログ ボックスについて話しているのではなく、複数のボタンを使用したスライドインの確認について話しているのです。

4

2 に答える 2

7

UIActionSheet はあなたが探しているものです。

開始するためのコード例を次に示します。

UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Save photo?" delegate:self cancelButtonTitle:@"No" destructiveButtonTitle:@"Yes" otherButtonTitles:nil];
 [actionSheet showInView:self.view];
 [actionSheet release];

これは、下からアクション シートにスライドします。ボタンが2つ付いています。はいといいえ。

ユーザーが任意のボタンを選択すると、actionSheet:didDismissWithButtonIndex:メソッドが呼び出されます

-(void) actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex{
//your code here
}

コントローラー クラスは < UIActionSheetDelegate > プロトコルにサブスクライブする必要があります

お役に立てれば!

于 2010-02-02T02:46:16.943 に答える
1
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"title" delegate:self cancelButtonTitle:@"cancel"  destructiveButtonTitle:@"destructive" otherButtonTitles:@"other", nil];
[actionSheet showInView:self.view];
[actionSheet release];
于 2010-02-02T02:44:05.250 に答える