Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UISplitView new slide-in popover becomes fullscreen after memory warning in iOS 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.)

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.

Any help is much appreciated!

like image 584
Joxy Avatar asked Mar 10 '12 19:03

Joxy


1 Answers

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.

like image 170
Jh2170 Avatar answered Oct 29 '22 00:10

Jh2170