fgrios

fgrios

8p

5 comments posted · 0 followers · following 0

241 weeks ago @ Seaside - Your first iPad split ... · 0 replies · +1 points

See my response to Chris below.

241 weeks ago @ Seaside - Your first iPad split ... · 3 replies · +2 points

This is what I did and it works fine.

-(void) viewWillAppear:(BOOL)animated {
if (self.interfaceOrientation == UIInterfaceOrientationPortrait || self.interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
UIViewController* master = [self.viewControllers objectAtIndex:0];
UIViewController* detail = [self.viewControllers objectAtIndex:1];
[self setupPortraitMode: master detail:detail];
}

}

- (void)setupPortraitMode: (UIViewController *)master detail:(UIViewController *)detail {
//adjust master view
CGRect f = master.view.frame;
f.size.width = 320;
f.size.height = 1024;
f.origin.x = 0;
f.origin.y = 0;

[master.view setFrame:f];

//adjust detail view
f = detail.view.frame;
f.size.width = 448;
f.size.height = 1024;
f.origin.x = 321;
f.origin.y = 0;

[detail.view setFrame:f];
}

- (void)willAnimateRotationToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration {
//get master and detail view controller
UIViewController* master = [self.viewControllers objectAtIndex:0];
UIViewController* detail = [self.viewControllers objectAtIndex:1];

//only handle the interface orientation
//of portrait mode
if(interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
[self setupPortraitMode: master detail:detail];
}
else {
//re-adjust detail view
CGRect f = detail.view.frame;
f = detail.view.frame;
f.size.width = 704;
f.size.height = 768;
f.origin.x = 321;
f.origin.y = 0;

[detail.view setFrame:f];
//call super method
[super willAnimateRotationToInterfaceOrientation:interfaceOrientation duration:duration];
}
}

241 weeks ago @ Seaside - Your first iPad split ... · 0 replies · +4 points

Doing that will definitely get your app rejected in the App store. Trust me, been there, done that.

243 weeks ago @ Seaside - Your first iPad split ... · 0 replies · +2 points

Thanks for that update. it works, you just need to take into account frame borders in the detail origin and width. Also, resizing the frames should probably take into account the visibility of the statusbar and rotation back to landscape view. But the technique does do exactly what is needed.

244 weeks ago @ Seaside - Your first iPad split ... · 2 replies · +1 points

Thank you for this article. I have been looking for some code that will allow me to KEEP the split view in portrait mode as does the SETTINGS app.

Apple's docs say that it is possible, but I have not been able to figure out or find an example of how to do this. I bet its probably something simple i am missing. Any ideas?