条件付きUIActionSheet
でボタンを追加する があります。多数のボタンがある場合 (ポートレート ビューの場合は特にそうです)、破壊的なボタンは (予想どおり) アクション シートから切り離され、アイテムをスクロールできるようになります。正しくないのは、背景がないことです。
UIActionSheet *sheet = [[UIActionSheet alloc]initWithTitle:nil
delegate:self
cancelButtonTitle: nil
destructiveButtonTitle:@"Changed my mind"
otherButtonTitles:MAILBUTTON, BOOKMARKSBUTTON, CLEARCOOKIESBUTTON, nil];
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
[sheet addButtonWithTitle:CAMERABUTTON];
}
sheet.tag = ACTION_SHEET;
if ([UIPrintInteractionController isPrintingAvailable])
{
[sheet addButtonWithTitle:PRINTBUTTON];
}
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
if ([prefs boolForKey:BUMP_ENABLED_KEY] == YES)
{
[sheet addButtonWithTitle:BUMPRECEIVEBUTTON];
if ([prefs boolForKey:BUMP_ALLOW_SENDING_KEY] == YES)
[sheet addButtonWithTitle:BUMPSENDBUTTON];
}
[sheet addButtonWithTitle: @""];
[sheet setCancelButtonIndex: sheet.numberOfButtons - 1];
[sheet showInView:self.view];
縦向きモードでは見栄えがよく、破壊ボタンには背景があります。ただし、さらに多くのボタンを追加すると、上記と同じ動作になります。