how to set a viewController only landscape in iOS8.0

68 views Asked by At

for i want to build a movie controller,and it`s pushed by a navigationController,how can i set it ,also only this vc can be landscape,others should only be portraitUp,please help,thanks in advance.

1

There are 1 answers

1
Reming Hsu On

Try..

- (void)viewDidAppear:(BOOL)animated
{
    NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft];
    [[UIDevice currentDevice] setValue:value forKey:@"orientation"];
}

- (void)viewDidDisappear:(BOOL)animated
{
    NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationPortrait];
    [[UIDevice currentDevice] setValue:value forKey:@"orientation"];
}