UIPopoverController中UIActionsheet大小的问题

时间:2011-07-06 08:40:12

标签: iphone ipad uipopovercontroller uiactionsheet

我已经向UIPopovercontroller添加了一个带有动态数量按钮的UIActionsheet,如果显示了弹出窗口,则会显示该按钮。我的问题是,如果按钮的数量是高的,UIActionsheet超出了弹出框的边框,按钮不会显示为列表。在横向视图中,操作表将按钮显示为列表,但是操作表的大小再次大于弹出窗口,因此弹出窗口顶部的文本不可见。

我已按以下方式添加了UIActionsheet:

    BookingDataDefaults *defaults = [BookingDataDefaults getInstance];
    if([defaults.profils count]>0){
        UIActionSheet *actionSheet = [[UIActionSheet alloc]init];
        actionSheet.delegate = self;
        actionSheet.title = NSLocalizedString(@"title", nil);
        int count = 0;
        for (ReservationProfil *profil in defaults.profils) {
            [actionSheet addButtonWithTitle:profil.profilName];
            count++;
        }
        [actionSheet addButtonWithTitle:NSLocalizedString(@"standard", nil)];
        count++;

        [actionSheet addButtonWithTitle:NSLocalizedString(@"cancel", nil)];
        actionSheet.destructiveButtonIndex = count;
        [actionSheet showInView:self];
        [actionSheet release];
    }

动作表可以很好地处理少量按钮。

有没有办法设置UIActionsheet的最大大小或在我看来改变一些东西以摆脱这个问题。

PS:popover中视图的大小正好是popover的contentSize的大小。

编辑:

我测试了Nitish的解决方案,它有点好但不完美,因为子视图根据超视图没有改变它们的大小。最佳解决方案是将操作表的大小设置为弹出窗口的大小。它将动作表放在弹出窗口的顶部,但列表是大或不显示。 结果显示如下:

肖像旧 - >肖像新

portrait old portrait new

旧景观 - >新景观

Landscape old Landscape new

0 个答案:

没有答案
相关问题