首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >uiactionsheet工作表高度

uiactionsheet工作表高度
EN

Stack Overflow用户
提问于 2012-04-20 07:15:58
回答 1查看 3.8K关注 0票数 2

我在UIActionSheet上有一个简单的问题!如何设置UIActionsheet的高度?我尝试过setFrame和setBounds,但都不起作用。我正在使用下面的行动手册:

代码语言:javascript
复制
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的内容自动调整高度。

提前谢谢你,

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-04-20 08:04:24

UIActionSheet的默认行为是自动调整到它的内容大小。你不应该直接设置frame

你会看到动作页占据了如此多的空间,因为你在标题中插入了一堆换行符,迫使标题标签占据了比它应该占据的垂直空间更多的空间。如果你不想动作单那么高,就不要把标题改成那样。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10238179

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档