在 UIPopoverController 中显示 UItableViewController
我正在 UIPopoverController 内显示 UITableViewController。一切工作正常,尽管 TableViewController 的大小非常大,即使只有 3-4 个单元格。我怎样才能使弹出窗口控制器的高度与表格视图的高度完全相同?
I am dispalying a UITableViewController inside a UIPopoverController. Everything works fine expect that the size of the TableViewController is very large even thought there are only 3-4 cells. How can I make it so the popover controller's height is exactly the same as tableview's height?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用
UIPopoverController
的方法- (void)setPopoverContentSize:(CGSize)sizeAnimated:(BOOL)animated
或使用UIViewController
上的属性@property(nonatomic, readwrite) CGSize contentSizeForViewInPopover
来实现此目的。You could use
UIPopoverController
's method- (void)setPopoverContentSize:(CGSize)size animated:(BOOL)animated
or use the property onUIViewController
@property(nonatomic, readwrite) CGSize contentSizeForViewInPopover
to achieve this.重写
UITableViewController
的contentSizeForViewInPopover
,如下所示:Override the
contentSizeForViewInPopover
of yourUITableViewController
like this: