1
我試圖在執行自定義細分時爲導航欄設置動畫。導航欄由導航控制器控制。下面的代碼允許嵌入視圖淡入淡出並放大視圖,儘管導航欄保持不動。導航欄中的更改如何動畫?在自定義細分中動畫導航欄
#import "MDAZoomSegue.h"
@implementation MDAZoomSegue
- (void)perform {
UIViewController *sourceViewController = (UIViewController *) self.sourceViewController;
UIViewController *destinationViewController = (UIViewController *) self.destinationViewController;
[sourceViewController.view addSubview:destinationViewController.view];
[destinationViewController.view setFrame:sourceViewController.view.window.frame];
[destinationViewController.view setTransform:CGAffineTransformMakeScale(1.2,1.2)];
[destinationViewController.view setAlpha:0];
[UIView animateWithDuration:0.5
delay:0.0
options:UIViewAnimationCurveEaseOut
animations:^{
[destinationViewController.view setTransform:CGAffineTransformMakeScale(1.0,1.0)];
[destinationViewController.view setAlpha:1.0];
}
completion:^(BOOL finished){
[destinationViewController.view removeFromSuperview];
[sourceViewController.navigationController pushViewController:destinationViewController animated:NO];
}];
}
@end