iphone - 使用自定义动画推送 View Controller

标签 iphone objective-c pushviewcontroller

是否可以制作像图像一样的自定义推送 View Controller 动画?基本思想是正常推送 View ,但不移动当前 View (调用 pushViewController...)。

ex

最佳答案

当然,这是可以做到的。我做了一个项目,我是这样做的:

-(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/

相关文章:

ios - 在 Storyboard Xcode 6 中包装几个元素

ios - 从应用程序委托(delegate)推送 View Controller

ios - 无法推送 ViewController iOS

iphone - 使用iOS6中的新 map ,是否可以更改图层的颜色(公园、水、建筑物)

iphone - 如何在 iPhone 中对这个 hitTest 覆盖进行单元测试?

ios - 在 iOS-charts swift iOS 8 中设置 yAxis

iOS:你认为可以用 ARKit 做 "image detection"吗?

iphone - 需要限制我的应用程序只在带有 L.E.D 的设备上运行

iOS:如何检测弹出或关闭后是否出现viewcontroller

iphone - 获取购买商品列表,inApp Purchase iPhone