在iOS 5.1中出现内存警告后,UISplitView新的滑入式弹出窗口将变为全屏显示 [英] UISplitView new slide-in popover becomes fullscreen after memory warning in iOS 5.1

查看:115
本文介绍了在iOS 5.1中出现内存警告后,UISplitView新的滑入式弹出窗口将变为全屏显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里很新. 我在UISplitView中使用新的iOS 5.1滑入式弹出框时遇到问题. (在5.1之前,主视图控制器以弹出框的形式显示,但现在它只是向左滑动.) 当我的设备处于纵向模式并且收到内存警告时,主视图控制器将卸载;当我按工具栏按钮在主视图中滑动时,它将再次加载. 但是,在出现内存警告后,它将以全屏显示,而不仅仅是原始主视图的大小. (当我将设备旋转到横向并返回纵向时,它会恢复到正确的尺寸.)

I'm quite new here. I have a problem with the new iOS 5.1 slide-in popover in UISplitView. (Before 5.1 the master view controller was presented in a popover, but now it simply slides in form the left.) When my device is in portrait mode and it receives a memory warning, the master view controller unloads; and when I press the toolbar button to slide in the master view, it loads again. However after the memory warning it is presented in fullscreen and not only the size of the original master view. (When I rotate the device to landscape and back to portrait, it gets its correct size back.)

在iOS 5.1之前,它总是以正确的大小显示在弹出窗口中.

Before iOS 5.1 it was always presented in the popover with the correct size.

任何人都有一个主意,如何解决这个问题?

Anyone has an idea, how to correct this?

我尝试设置主视图的框架大小,但不能解决问题.

I've tried to set the master view's frame size, but it doesn't solve the problem.

非常感谢您的帮助!

推荐答案

我遇到了相同的问题,但是我使用以下代码解决了该问题:

I had the same problem, but I used this code to solve the problem:

-(void)splitViewController:(UISplitViewController *)svc popoverController:(UIPopoverController *)pc willPresentViewController:(UIViewController *)aViewController
{
    aViewController.view.frame = CGRectMake(0, 0, 320, self.view.frame.size.height);
}

显然,当收到内存警告时,视图控制器将被释放,因此当其再次出现时,它将从其父视图(全屏显示)中获得其大小.因此,您只需在每次加载框架时重置框架即可.

Apparently when a memory warning is received, the view controller gets released, so when it presents itself again, it gets it's size from it's parent view, which is full screen. So you just have to reset the frame every time it gets loaded.

这篇关于在iOS 5.1中出现内存警告后,UISplitView新的滑入式弹出窗口将变为全屏显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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