내 앱에서 scrollview가 있고 두 번째로 scrollview의 마지막 페이지로 스크롤합니다. tableviewcontroller에 연결됩니다.segue 동안 회전이 깨졌습니다.
- (void) perform {
UIViewController *src = (UIViewController *) self.sourceViewController;
UIViewController *dst = (UIViewController *) self.destinationViewController;
src.view.transform = CGAffineTransformMakeTranslation(0, 0);
dst.view.transform = CGAffineTransformMakeTranslation(320, 0);
[UIView animateWithDuration:0.3
animations:^{
[src presentModalViewController:dst animated:NO];
src.view.transform = CGAffineTransformMakeTranslation(320, 0);
dst.view.transform = CGAffineTransformMakeTranslation(0, 0);
}
];
}
그리고 사용자가 UIInterfaceOrientationPortrait에있을 때 그것은 마법처럼 작동합니다
하지만 UIStoryboardSegue 클래스를 확장 및 구현의 tableview 컨트롤러에있는 ScrollView에서 점프 할 때 "애니메이션 같은 페이징"을 달성하기 위해
이 같은 방법을 수행 정위. 하지만 UIInterfaceOrientationLandscapeLeft 또는 Right로 전환하면 제대로 작동하지 않습니다.내가 기본적으로 여기 을하고 싶은 것은 tableviewcontroller이 (하지가 기본 동작입니다으로 상단 또는 하단에서) 메인 화면에 왼쪽에서 오는 것 같습니다 그래서 위의 코드처럼을 SEGUE을 수행하는 것입니다 정상적인 방향으로 작동합니다. 나는 다음과 같은 해결책을 상상해 보았다.
- (void) perform {
UIViewController *src = (UIViewController *) self.sourceViewController;
UIViewController *dst = (UIViewController *) self.destinationViewController;
if ([[UIDevice currentDevice]orientation] == UIInterfaceOrientationLandscapeLeft || [[UIDevice currentDevice]orientation] == UIInterfaceOrientationLandscapeRight){
}else{
src.view.transform = CGAffineTransformMakeTranslation(0, 0);
dst.view.transform = CGAffineTransformMakeTranslation(320, 0);
}
[UIView animateWithDuration:0.3
animations:^{
[src presentModalViewController:dst animated:NO];
if ([[UIDevice currentDevice]orientation] == UIInterfaceOrientationLandscapeLeft || [[UIDevice currentDevice]orientation] == UIInterfaceOrientationLandscapeRight){
}else{
src.view.transform = CGAffineTransformMakeTranslation(320, 0);
dst.view.transform = CGAffineTransformMakeTranslation(0, 0);
}
}
];
}
그러나 나는 어떤 도움이 주어지기가 더 어렵다.
질문 업데이트 :
내가 지금이 시도 :
- (void) perform {
UIViewController *src = (UIViewController *) self.sourceViewController;
UIViewController *dst = (UIViewController *) self.destinationViewController;
[UIView transitionWithView:src.navigationController.view duration:0.3
options:UIViewAnimationTransitionFlipFromRight
animations:^{
[src.navigationController pushViewController:dst animated:YES];
}
completion:NULL];
}
나는 다음과 같은 얻을 오류 :
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Pushing a navigation controller is not supported'
두 번째 부분은 나에게 좋았습니다. 새로운보기 컨트롤러의 오른쪽에서 뒤집은 것과 같습니다. – London