In my app, all view is opening in Portait
mode, But I want to change the mode for AVPlayer view
, means When user come on this view, device orientation is automatically change in to Landscape
mode.
I have implemented this using following code. It works fine, I want to just confirm, by using following code, there will be any problem when I upload my app on appstore.
-(void)viewDidAppear:(BOOL)animated
{
if(UIDeviceOrientationIsPortrait(self.interfaceOrientation)){
if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientation:)])
{
objc_msgSend([UIDevice currentDevice], @selector(setOrientation:), UIInterfaceOrientationLandscapeLeft );
}
}
}
-(void)viewDidDisappear:(BOOL)animated{
if(UIDeviceOrientationIsLandscape(self.interfaceOrientation)){
if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientation:)])
{
objc_msgSend([UIDevice currentDevice], @selector(setOrientation:), UIInterfaceOrientationPortrait );
}
}
}