开发者

How to give orientation support to only two of my viewcontrollers?

Ho wcan i give orientation support to two of my开发者_StackOverflow社区 viewcontrollers in my app? Infect i have a tabbar based application and ii have added navigation items in tabbar. i have a custom TabBarViewController and in that view controller i allow orientation

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

        return YES;
}

now i don't want orientation support in every view controller. I need it only in two or three viewcontrollers. when i write return (interfaceOrientation = UIInterfaceOrientationPortrait); in any view controller, it do not work, and application remain changing its orientation. and if i stop orientation from my CustomTabBarViewController then it stops the orientation of whole application.

can any one help me? I just got stuck here

Thanks in advance


I think that you can't do that if using tabBars. When using a tabbarcontroller and a change of orientation is request, it will called every viewcontroller that hangs in the tabbarcontroller, doesn't matter if it is visible. So if any of them answers NO, no one will change.

It's something like "of everyone or no one".


A tabbar won't rotate unless all it's viewcontrollers will. http://www.cimgf.com/2008/11/13/landscape-tab-bar-application-for-the-iphone/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜