Add notifier in viewWillAppear function
-(void)viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:UIDeviceOrientationDidChangeNotification object:nil]; }
Orientation notifies this feature
- (void)orientationChanged:(NSNotification *)notification{ [self adjustViewsForOrientation:[[UIApplication sharedApplication] statusBarOrientation]]; }
which in turn calls this function, which processes the moviePlayerController frame orientation
- (void) adjustViewsForOrientation:(UIInterfaceOrientation) orientation { switch (orientation) { case UIInterfaceOrientationPortrait: case UIInterfaceOrientationPortraitUpsideDown: {
in viewDidDisappear delete notification
-(void)viewDidDisappear:(BOOL)animated{ [super viewDidDisappear:animated]; [[NSNotificationCenter defaultCenter]removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil]; }
I think this is the fastest and can change the view depending on the orientation
Vimal Venugopalan Aug 23 2018-12-12T00: 00Z
source share