Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
371 views
in Technique[技术] by (71.8m points)

ios7 - How to set one of the screens in landscape mode in iphone?

I am developing iphone application in iOS7, i am facing problem in autorotate single screen in landscape mode programatically, while other screens remains in portrait mode. I am using Story board.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I used following and its working for me in both iOS6 and iOS7 also,try following way :

// Added method for Autorotation in you app delegate
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
    //NSLog(@"AppDelegate -- supportedInterfaceOrientationsForWindow");
    if([UICommonUtils isiPhone]){
        return UIInterfaceOrientationMaskPortrait;
    }else if(flagOrientationAll == YES){
        return UIInterfaceOrientationMaskLandscape;
    } 
}

Add following in your view controller

// set flag "flagOrientationAll" to rotate only one view in your perticular view 
-(void)viewWillAppear:(BOOL)animated
{
    NSLog (@"webViewController -- viewWillAppear");
    [super viewWillAppear:animated];
 PlayWithWSWithLibAppDelegate *delegate = (PlayWithWSWithLibAppDelegate *) [[UIApplication sharedApplication] delegate];
    delegate.flagOrientationAll = YES;
}

-(void)viewWillDisappear:(BOOL)animated
{
    NSLog (@"webViewController -- viewWillDisappear");
    PlayWithWSWithLibAppDelegate *delegate = (PlayWithWSWithLibAppDelegate *)[[UIApplication sharedApplication] delegate];
    delegate.flagOrientationAll = NO;

}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...