首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在UIPopoverController中显示UItableViewController

在UIPopoverController中显示UItableViewController
EN

Stack Overflow用户
提问于 2011-08-17 19:46:47
回答 2查看 612关注 0票数 1

我正在解析UIPopoverController中的UITableViewController。一切正常,除了TableViewController的大小非常大,即使只有3-4个单元格。如何才能使popover控制器的高度与tableview的高度完全相同?

EN

回答 2

Stack Overflow用户

发布于 2011-08-18 00:24:13

您可以使用UIPopoverController的方法- (void)setPopoverContentSize:(CGSize)size animated:(BOOL)animated或使用UIViewController @property(nonatomic, readwrite) CGSize contentSizeForViewInPopover上的属性来实现此目的。

票数 0
EN

Stack Overflow用户

发布于 2013-04-08 02:46:32

覆盖UITableViewControllercontentSizeForViewInPopover,如下所示:

代码语言:javascript
运行
复制
- (CGSize)contentSizeForViewInPopover {
    // Currently no way to obtain the width dynamically before viewWillAppear.
    CGFloat width = 200.0; 
    CGRect rect = [self.tableView rectForSection:[self.tableView numberOfSections] - 1];
    CGFloat height = CGRectGetMaxY(rect);
    return (CGSize){width, height};
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7092282

复制
相关文章

相似问题

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