Hier entlassen mein Code verwendet, um eine navigationViewController vorstellen:CATransition falsch auf Orientierungsänderung zu arbeiten, bevor ein NavigationViewController
-(IBAction)showFilterView:(id)sender {
FilterViewController *vc=[self.storyboard instantiateViewControllerWithIdentifier:@"FilterViewController"];
UINavigationController *nvc=[[UINavigationController alloc] initWithRootViewController:vc];
CATransition *transition = [CATransition animation];
transition.duration = 0.35;
transition.timingFunction =
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionMoveIn;
transition.subtype = kCATransitionFromLeft;
UIView *containerView = self.view.window;
[containerView.layer addAnimation:transition forKey:nil];
[self.tabBarController presentViewController:nvc animated:NO completion:nil];
}
Und hier ist mein Code
-(IBAction)back:(id)sender {
CATransition *transition = [CATransition animation];
transition.duration = 0.35;
transition.timingFunction =
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionMoveIn;
transition.subtype = kCATransitionFromRight;
UIView *containerView = self.view.window;
[containerView.layer addAnimation:transition forKey:nil];
[[self.navigationController presentingViewController] dismissViewControllerAnimated:NO completion:nil];
}
Situation 1 --- Arbeiten zu entlassen auch im Landschaftsmodus
Situation 2 --- Arbeiten auch im Portrait-Modus
Situation 3 --- Im Hochformatmodus zeigen und im Querformat ablehnen funktioniert nicht richtig (zusätzliche Animation vor Anzeige der korrekten Ansicht)
Situation 4 --- Im Querformat und im Hochformat nicht korrekt arbeiten (zusätzliche Animation, bevor die korrekte Ansicht angezeigt wird)
Ist es https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/RespondingtoDeviceOrientationChanges/RespondingtoDeviceOrientationChanges.html helfen – aProgrammer
ich Ihren Code auf dem iPad-Projekt getestet und es funktioniert mit einer Animation in Ordnung, außer, dass ich getestet mit presenting from self nicht von einem tabBarController: '[self presentViewController: nvc animiert: NO completion: nil]' – Idali
In UIView * containerView = self.view.window weisen Sie das ganze Fenster (UIWindow *) einer UIView * zu. Sollten Sie die Ansichtsebene nicht animieren, nicht das Fenster? –