我正在解析UIPopoverController中的UITableViewController。一切正常,除了TableViewController的大小非常大,即使只有3-4个单元格。如何才能使popover控制器的高度与tableview的高度完全相同?
发布于 2011-08-18 00:24:13
您可以使用UIPopoverController
的方法- (void)setPopoverContentSize:(CGSize)size animated:(BOOL)animated
或使用UIViewController
@property(nonatomic, readwrite) CGSize contentSizeForViewInPopover
上的属性来实现此目的。
发布于 2013-04-08 02:46:32
覆盖UITableViewController
的contentSizeForViewInPopover
,如下所示:
- (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};
}
https://stackoverflow.com/questions/7092282
复制相似问题