-(void)forceToOriention:(UIInterfaceOrientation)direction
{
if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientation:)]) {
SEL selector = NSSelectorFromString(@"setOrientation:");
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[UIDevice instanceMethodSignatureForSelector:selector]];
[invocation setSelector:selector];
[invocation setTarget:[UIDevice currentDevice]];
int val = direction;
[invocation setArgument:&val atIndex:2];
[invocation invoke];
}
}
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self forceToOriention:UIInterfaceOrientationLandscapeRight];
}
- (void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
[self forceToOriention:UIInterfaceOrientationPortrait];
}