在uipopovercontroller中推送新的tableViewController会导致调整弹出框的大小 [英] push a new tableViewController in a uipopovercontroller causes the popover to be resized

查看:55
本文介绍了在uipopovercontroller中推送新的tableViewController会导致调整弹出框的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找到了这个线程,但是仍然不能解决我的问题. UIPopoverController在pushViewController上自动调整为最大高度

I found this thread, but it still doesn't fix my problem. UIPopoverController automatically resizing to max height on pushViewController

我有一个UIPopoverController,它推送了一个导航控制器.当我显示此弹出窗口时,将contentSizeForPopover设置为340,340.很好在弹出窗口中,我有一个按钮,它将一个新的UITableViewController推入已存在的UIPopoverController(tableViewController的以下代码).

I have a UIPopoverController that pushes a navigationcontroller. When I present this popover, I set the contentSizeForPopover to 340,340. That works fine. In the popover, I have a button, that pushes a new UITableViewController into the already existing UIPopoverController (code below for the tableViewController).

UITableViewController *contentView = [[UITableViewController alloc] initWithStyle:UITableViewStylePlain];
contentView.tableView.delegate = self;
contentView.tableView.dataSource = self;
[self.navigationController pushViewController:contentView animated:YES];
[contentView release];

按下tableView时,高度会增加到iPad的最大高度.当我按下后退"按钮时,该高度仍处于最大高度,并且没有返回到最初创建UIPopoverController时所定义的340,340高度.有没有办法为我创建的新tableView再次设置此值?谢谢.

When the tableView gets pushed, the height grows to the max height of the iPad. When I press the back button, the height still is at the max height and does not go back to the 340,340 height that was defined when the UIPopoverController was originally created. Is there a way to set this value again for the new tableView I created? Thanks.

推荐答案

根据我对UIPopoverController对象的经验,每当将新内容添加到弹出框时,弹出框似乎就会使用最大高度.每次更改内容时,我都会向Popover控制器发送一条setPopoverContentSize:animated:消息,这当然要求我在每个可能导致Popover调整大小的对象中保留对该Popover控制器的引用.您可以在问题的示例代码之后立即添加该消息发送,以防止调整弹出窗口的大小,但是当您从UINavigationController堆栈中弹出该视图时,消息发送的大小仍可能会调整,因此可能需要再次发送消息.可能出现在弹出窗口中的每个视图控制器都将以其viewWillAppear:方法发送setPopoverContentSize:animated:消息.每个对象还将具有对弹出框控制器的引用.

In my experience with UIPopoverController objects, the popover seems to use the maximum height whenever new content is added to the popover. I send the popover controller a setPopoverContentSize:animated: message every time I change the content, which of course requires me to keep a reference to that popover controller in every object that may cause the popover to resize. You could add that message send right after your sample code in your question to keep the popover from resizing, but it may still resize when you pop off this view from the UINavigationController stack, so another message send may be needed. Maybe each view controller that may appear in the popup will send the setPopoverContentSize:animated: message in its viewWillAppear: method. Each will also have a reference to the popover controller.

这篇关于在uipopovercontroller中推送新的tableViewController会导致调整弹出框的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆