IOS: custom view for landscape and portrait in tab bar application
I have a tab bar application, in one tab I have a view that has a different item(look) for landscape and portrait. my questio开发者_开发知识库n is how can I handle this feature. Thanks for helping me.
I had similar issue. You can just check orientation by:
UIViewController* vc = //your current view controller
UIInterfaceOrientation orientation = vc.interfaceOrientation;
// NSLog(@"orientation %@",orientation);
if(orientation == UIInterfaceOrientationLandscapeRight){...}
inside the if statement setup desired layout. If you have it in nib file you can substitude the whole view by self.view = portairtView; which can be defined and in the same nib. You can do same thing with an inner part of the view.
You can handle them as you would normally do using
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
精彩评论