如何调整动作表的大小?目标C.

时间:2016-03-29 05:22:13

标签: ios objective-c storyboard uiactionsheet

朋友我使用了一个简单的操作表,其中包含以下代码: -

popup = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:
                        @"Set Calander",
                        @"New Host",
                        @"Approvel",
                        @"Book Session",
                        @"Alter Session",
                        @"Update Post",
                        @"Center View",
                        @"Log Out",
                        nil];
[popup showInView:self.view];

当我在任何iphone模拟器中运行它时效果很好但是当我尝试在iPad中运行时我的动作表没有正确显示。我使用了故事板。enter image description here

1 个答案:

答案 0 :(得分:2)

如果设备是ipad而不是showinview,请使用其他方法,例如tabbarbarbuttonitemrectinview

参考样本代码

-(void)actionPhotoShare:(id)sender
    {
    actionSheetShare = [[UIActionSheet alloc] initWithTitle:nil 
                                                                  delegate:self 
                                                         cancelButtonTitle:nil
                                                    destructiveButtonTitle:NSLocalizedString(@"ActionSheet_Cancel", @"")
                                                         otherButtonTitles:NSLocalizedString(@"ActionSheet_Email", @""),nil];

    if (IS_DEVICE_IPAD) {
        [actionSheetShare showFromBarButtonItem:sender animated:YES];
    }else {
        [actionSheetShare showInView:self.view];
    }
    }