Mahesh
Mahesh

Reputation: 662

Detail View of Split view controller doesnt changing its size in ios 4.2?

In my iPad application, i have used UISplitViewController where master view contains table view while detail view holds UIViewController. On button event detail view comes over master view, code is mentioned following. This code works fine on iPad 3.2 but not working on ios 4.2.

UIViewController *leftUIV = [appDelegate.splitViewController.viewControllers objectAtIndex:0];  
UIViewController *rightUIV = [appDelegate.splitViewController.viewControllers objectAtIndex:1];  
CGRect rectMaster = leftUIV.view.frame;  
CGRect rectDetail = rightUIV.view.frame;  
rectMaster.size.width = 0;
rectDetail.size.width = 1024;  
rectDetail.origin.x = 0;  
[leftUIV.view setFrame:rectMaster];  
[rightUIV.view setFrame:rectDetail];

Please help, How should I solve it?

Upvotes: 0

Views: 3675

Answers (3)

Manni
Manni

Reputation: 11148

Add this to your DetailViewController.m

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
    [self.view sizeToFit];

    NSLog(@"ROTATE - self.view.frame = %@", NSStringFromCGRect(self.view.frame)); 
}

Upvotes: 0

Mahesh
Mahesh

Reputation: 662

Finally got the answer on site Click here

Thanks to - Alice Bevan and McGregor

Upvotes: 3

Amy Worrall
Amy Worrall

Reputation: 16337

I think you're trying to do something unsupported. You can't resize the splits: the sizes are fixed.

If you wanted to temporarily show only the detail view in landscape mode, perhaps you could remove the split view from the view hierarchy and add just the detail view instead, then swap them back when you're done?

Upvotes: 1

Related Questions