내가 내 부모 뷰 컨트롤러와 풍경을 통해 투명 뷰 컨트롤러를 표시하고아이 뷰 컨트롤러 방향이
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];
를 사용하여 내 부모 뷰 컨트롤러에 자식 뷰 컨트롤러를 표시하고 아이폰 OS에서 변경 될 때 부모 뷰 컨트롤러를 회전하는 방법 만. 하지만 문제는 내가 왼쪽에서 오른쪽으로 또는 오른쪽에서 왼쪽으로 장치를 내 자식보기 컨트롤러 방향 변경보다 왼쪽에서 오른쪽으로 변경하지만 부모보기 컨트롤러는 같은 방향으로 유지됩니다.
자식보기 컨트롤러를 표시하지 않을 때 부모보기 컨트롤러 방향이 변경된다 자식과 함께 부모보기 컨트롤러 방향을 어떻게 바꿀 수 있습니까?
프로그래밍을 통해 오리엔테이션을 변경하려고 할 때 알림 센터를 자식에서 부모로 전달하여 방향을 변경하려고했습니다.
부모 뷰 컨트롤러-(void)rotateParent:(NSNotification *)notification
{
CGAffineTransform transform = CGAffineTransformMakeRotation(-M_PI);
self.view.transform = transform;
NSLog(@"Parent rotate ");
}
에서 아이 뷰 컨트롤러
- (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;
}
에서
하지만 난 내 "rotateParent"방법보다 상위 뷰를 통해 내 아이를 표시하기 위해 클릭 할 때 기본적으로 한 번에 실행 얻을. 다른 해결책 ??
따라서 다음 회전에서 알림을 전달할 수 없습니까? –
shouldAutorotateToInterfaceOrientation – prasad
@prasad에서 알림을 보내실 수 있습니까? 작동하지 않습니다. 왜냐하면 iOS 5 이상 지원했기 때문입니다.그리고 ios 6 –