1

条件付きUIActionSheetでボタンを追加する があります。多数のボタンがある場合 (ポートレート ビューの場合は特にそうです)、破壊的なボタンは (予想どおり) アクション シートから切り離され、アイテムをスクロールできるようになります。正しくないのは、背景がないことです。

iOS7 スクリーンショット

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];

縦向きモードでは見栄えがよく、破壊ボタンには背景があります。ただし、さらに多くのボタンを追加すると、上記と同じ動作になります。

4

1 に答える 1