带有UINavigationController的UIPopoverController子视图contentSizeForViewInPopover不适用于Parent [英] UIPopoverController w/ UINavigationController Subview contentSizeForViewInPopover doesnt work on Parent

查看:104
本文介绍了带有UINavigationController的UIPopoverController子视图contentSizeForViewInPopover不适用于Parent的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有子类UINavigationController的UIPopoverController。父视图和子视图都是UITableviews。

I have a UIPopoverController with a subclass UINavigationController. Both the parent and child views are UITableviews.

当我最初使用contentSizeForViewInPopover =(320,480)调用父视图时,效果很好。

When i call parent view originally with contentSizeForViewInPopover = (320,480) it works great.

当我点击子视图时,我将popover的大小调整为contentSizeForViewInPopover =(320,780)

When i click into the child view i resize the popover to contentSizeForViewInPopover = (320,780)

当返回到父视图时,我无法获得弹出窗口调整大小回到contentSizeForViewInPopover =(320,480)。 popover保持在(320,780)大小。

When return back to the parent view i cannot get the popover to resize back to contentSizeForViewInPopover = (320,480). the popover stays at the (320,780) size.

尝试了一切,但只是遗漏了一些东西。在上面的场景中,任何人都知道如何使用UIPopoverControllers调整视图大小?

Been trying everything but just missing something. Anyone know how resize the view with UIPopoverControllers in the above scenario?

先谢谢!!

推荐答案

我遇到了同样的问题,但上述解决方案都不适合我。然而,在尝试结合他们的方法时,我受到启发,尝试以稍微不同的方式来解决问题。这对我有用:

I had the same problem, but none of the above solutions worked for me. However, in trying to combine their approaches, I was inspired to try a slightly different way to attack the problem. This works for me:

-(void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    viewController.contentSizeForViewInPopover = navigationController.topViewController.view.frame.size;
}

我有三个不同的弹出窗口,每个弹出窗口都使用导航视图控制器。这个解决方案具有很好的副作用,因为它不会对任何弹出控制器进行特定的引用,但最终会使用当前正在使用的弹出控制器中的popoverContentSize。

I have three different popovers that each use navigation view controllers. This solution has the nice side effect of working for all of them because it doesn't make a specific reference to any of the popover controllers, but ends up using the popoverContentSize from the popover controller currently being used.

这篇关于带有UINavigationController的UIPopoverController子视图contentSizeForViewInPopover不适用于Parent的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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