I am displaying Child view controller on my 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 am displaying transparent view controller over my parent view controller and its landscape only. but issue is when i change the device from landscape left to landscape right or right to left than my child view controller orientation changes but parent view controller remain same orientation.
My parent view controller orientation changes when i am not displaying child view controller how can i change parent view controller orientation along with child?
One thing i tried to change orientation by programming passing Notification Center from child to parent to change the orientation.
In 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 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 over parent view than my "rotateParent" method get executed one time by default. any other solution??