是否可以制作像图像一样的自定义推送 View Controller 动画?基本思想是正常推送 View ,但不移动当前 View (调用 pushViewController...
)。
最佳答案
当然,这是可以做到的。我做了一个项目,我是这样做的:
-(void)slideInController:(RDSlideController *) next {
next.presentingVC = self;
next.view.frame = CGRectMake(self.view.frame.origin.x + 320, self.view.frame.origin.y, self.view.frame.size.width, self.view.frame.size.height);
[self.view.window addSubview:next.view];
[UIView animateWithDuration:slideTime animations:^{
next.view.frame = self.view.frame;
} completion:^(BOOL finished) {
self.view.window.rootViewController = next;
}];
}
我滑入的 View Controller 是 RDSlideController 的子类(因此我可以拥有presentingVC 属性和其他一些东西),但这并不是真正必要的。基本上,您只需实例化新 Controller ,将其 View 的框架设置为在屏幕右侧,将该 View 添加到窗口,然后将框架设置为当前 View 的框架的动画。最后,切换 View Controller ,以便新的 View Controller 现在成为窗口的 Root View Controller 。
关于iphone - 使用自定义动画推送 View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14886990/