vendredi 31 juillet 2015

How to fix orientation of few controller in portrait mode only?

I am developing an application in which i am having one Navigation Controller which further has few ViewController as child.Now for few ViewController i want keep the orientation for portrait mode.How can i do that ?

EDIT:

I created custom view controller class as PortraitViewController & add below code in PortraitViewController.m

@interface PortraitViewController ()

@end

@implementation PortraitViewController

- (BOOL)shouldAutorotate
{

    return YES;
}

- (NSUInteger)supportedInterfaceOrientations
{
    //Here check class name and then return type of orientation
    return UIInterfaceOrientationMaskPortrait;
}

@end

After that i implemented PortraitViewController.h as base class

#import <UIKit/UIKit.h>
#import "PortraitViewController.h"
@interface Login : PortraitViewController
@end

But still now working if rotate the device into landscape mode.

Aucun commentaire:

Enregistrer un commentaire