I show the Child view controller on the parent view controller using
childView1 *viewController = [[childView1 alloc]initWithNibName:examTFVC_NIB bundle:nil row:gesture.view.tag productID:test_productID size:testsize Duration:duration]; self.modalPresentationStyle = UIModalPresentationCurrentContext; self.view.alpha = 0.4f; viewController.view.backgroundColor = [UIColor clearColor]; viewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical; [self presentViewController:viewController animated:YES completion:NULL];
I show a transparent view controller above the parent view controller and its landscape. but the problem is when I change the device from landscape from left to landscape from right or right to left, than the orientation changes of the controller of my child view, but the controller of the parent view remains the same orientation.
My orientation of the parent view controller changes when I do not show the child view controller, how can I change the orientation of the parent view controller along with the child?
One thing I tried to change orientation was by programming the Notification Center transfer from child to parent to change the orientation.
In the child view controller
- (NSUInteger)supportedInterfaceOrientations { NSUInteger supportedOrientations = UIInterfaceOrientationMaskLandscape; [[NSNotificationCenter defaultCenter] postNotificationName:@"RotateParent"object:nil]; return supportedOrientations; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight ); } - (BOOL)shouldAutorotate { return YES; }
In the parent view controller
-(void)rotateParent:(NSNotification *)notification { CGAffineTransform transform = CGAffineTransformMakeRotation(-M_PI); self.view.transform = transform; NSLog(@"Parent rotate "); }
but when I click to display my child above the parent view, my rotateParent method executes by default once. any other solution?
ios iphone ios5 ipad uiinterfaceorientation
Swap-IOS-Android
source share