Iphone 单板高度

Iphone 单板高度,iphone,ios,uiactionsheet,Iphone,Ios,Uiactionsheet,我在行动表上有一个简单的问题!如何设置UIActionsheet的高度?我试过setFrame和挫折,但都不管用。我正在使用以下行动表: NSString *title = UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation) ? @"\n\n\n\n\n\n\n\n\n" : @"\n\n\n\n\n\n\n\n\n\n\n\n" ; UIActionSheet *actionSheet = [[UIA

我在行动表上有一个简单的问题!如何设置UIActionsheet的高度?我试过setFrame和挫折,但都不管用。我正在使用以下行动表:

NSString *title = UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation) ? @"\n\n\n\n\n\n\n\n\n" : @"\n\n\n\n\n\n\n\n\n\n\n\n" ;
    UIActionSheet *actionSheet = [[UIActionSheet alloc] 
                                  initWithTitle:[NSString stringWithFormat:@"%@%@", title, NSLocalizedString(@"", @"")]
                                  delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Button1",@"Button2", nil];
    [actionSheet setTag: 1];
    //[actionSheet setBounds:CGRectMake(0,0,320,150)];
    //[actionSheet showFromRect:CGRectMake(0,0,100,50) inView: self.parentViewController.tabBarController.view animated:YES];
   // [actionSheet setFrame:CGRectMake(0, 30, 320, 30)];
    actionSheet.actionSheetStyle = UIActionSheetStyleAutomatic;
    [actionSheet showInView:self.parentViewController.tabBarController.view];
     actionSheet = nil;
我这里的问题是动作表的高度等于当前视图的高度。我想根据UIActionSheet的内容自动调整高度


提前感谢,

UIActionSheet
的默认行为是自动调整其内容大小。您不应该直接设置


你会看到动作表占据了很大的空间,因为你在标题中插入了一堆换行符,迫使标题标签占据了更多的垂直空间。如果你不想让动作表那么高,就不要这样修改标题。

UIActionSheet
的默认行为是自动调整其内容大小。您不应该直接设置


你会看到动作表占据了很大的空间,因为你在标题中插入了一堆换行符,迫使标题标签占据了更多的垂直空间。如果你不想让动作片那么高,就不要把标题改成那样。

@RamaBoya,没问题。至少你在问题中加入了新词。。。否则就不可能回答了。@RamaBoya,没问题。至少你在问题中加入了新词。。。否则就不可能回答。