Frame size of detailed view splitviewcontroller does not change in ios4.2

I am using splitviewcontroller with two main views and a detailed view in my ipad application. When changing the orientation of the ipad from portrait to landscape, I need to hide the main view and change the frame size of the detailed view so that it is displayed in full screen. For this, I use this code.

    - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
       //adjust master view
       UIViewController *master = [self.splitViewController.viewControllers objectAtIndex:0];
       UIViewController *detail = [self.splitViewController.viewControllers objectAtIndex:1];
       CGRect t = master.view.frame;
       t.size.width = 0;
       t.size.height = 0;
       t.origin.x = 0;
       t.origin.y = 0;
       [master.view setHidden:YES];
       [master.view setFrame:t];

       //adjust detail view
       CGRect f = detail.view.frame;
       f.size.width = 1004;
       f.size.height = 768;
       f.origin.x = 0;
       f.origin.y = 0;

       [detail.view setFrame:f];

}

This code works exactly on ios3.2, but does not work for ios4.2. The master view is hidden in ios4.2, but the size of the detailed view size does not change.

Please help me. thanks shruti

+3
source share
1 answer

, , , , , , , . . , . .

ListingViewController *viewController = [[ListingViewController alloc] initWithNibName:@"ListingViewController" bundle:[NSBundle mainBundle]];  
UINavigationController *modalVC = [[UINavigationController alloc]initWithRootViewController:viewController]; // to add navigation bar
modalVC.navigationBar.barStyle = UIBarStyleBlackOpaque;
[self.navigationController presentModalViewController:modalVC animated:YES];
[modalVC release];
[viewController release];
0

Source: https://habr.com/ru/post/1780853/


All Articles