SplitView detail view returns wrong view frame ? SplitView detail view returns wrong view frame ? ios ios

SplitView detail view returns wrong view frame ?


In viewDidLoad the view is not supposed to have its real size. That is set up later by layout methods. But that shouldn't stop you :) How do you set your autoresizing mask? If you have set it correctly, everything should be ok.


if you wait for -(void)viewDidLayoutSubviewsit will have the right size


I am currently writing a UISplitViewController app, and was disappointed to find out changing the the size of the detail or master view is forbidden. It is totally in charge of the size of the those sub frames.

Like UINavigationController and UITabBarController, UISplitViewController is a 'container' view controller, and it shapes it's subviews to fit it's purposes.

The function self debugDumpTheFrames prints out the uisplitviewcontroller's frame and it's two subframes. I print the frames in the splitViewController's viewDidLoad, and set a timer to call this function a second time 2 seconds later (during which time i Do nothing):

[self debugDumpTheFrames];NSTimer* timer = [NSTimer scheduledTimerWithTimeInterval:2.0f target:self selector:@selector(debugDumpTheFrames) userInfo:nil repeats:NO];

If we look at the output, we can see that sometime after viewdidload, the UISplitViewController has changed the frames of it's subviews.

size of splitviewcontrollers view frame {{0, 0}, {748, 1024}}size of splitviewcontrollers detail view frame {{0, 0}, {768, 1024}}size of splitviewcontrollers master view frame {{0, 0}, {768, 1024}}size of splitviewcontrollers view frame {{0, 0}, {748, 1024}}size of splitviewcontrollers detail view frame {{321, 0}, {703, 748}}size of splitviewcontrollers master view frame {{0, 0}, {320, 748}}

Where exactly it does this resizing I am unsure; but the uisplitviewcontroller is the boss of those frames, and they are private properties so touching them is grounds for rejection from the store.