开发者

Problems with size of UIActionsheet in UIPopoverController

I've added an UIActionsheet with a dynamically number of buttons to a UIPopovercontroller, that appears if the popover is shown. My problem is that if the number of buttons is to hight the UIActionsheet exceeds the borders of the popover and the buttons are not shown as a list. At landscape view the actionsheet shows the buttons as a list, but the size of the actionsheet is again bigger the the popover, so that the text at the top of the popover is not visisble.

I've added the UIActionsheet in the following way:

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

       开发者_JAVA百科 [actionSheet addButtonWithTitle:NSLocalizedString(@"cancel", nil)];
        actionSheet.destructiveButtonIndex = count;
        [actionSheet showInView:self];
        [actionSheet release];
    }

The actionsheet works with a small number of buttons perfectly.

Is there any way to set a maximum size of the UIActionsheet or change something at my view to get rid of that problem.

PS: The size of the view in the popover is exactly the size of the contentSize of the popover.

EDIT:

I've test Nitish's solution, it's a little bit better but not perfect, because the subviews do not changed their size according to the superview. The best solution was to set the size of the actionsheet to the size of the popover. it places the actionsheet at the top of the popover but the list is eather to big or not shown. The result is shown down:

Portrait old -> Portrait new

Problems with size of UIActionsheet in UIPopoverController

Problems with size of UIActionsheet in UIPopoverController

Landscape old -> Landscape new

Problems with size of UIActionsheet in UIPopoverController

Problems with size of UIActionsheet in UIPopoverController

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜