【问题标题】:Animate UIView elements between transition of 2 UIViewControllers在 2 个 UIViewController 的过渡之间为 UIView 元素设置动画
【发布时间】:2013-09-08 19:07:35
【问题描述】:

我有 2 个 UIViewControllers,其中包含类似的 UIView 组件。例如,第一个 UIViewController 可以有一个小的 UIImageView,而第二个 UIViewController 有一个大的 UIImageView。

使用UIView animateWithDuration:animations:

我可以做类似的事情

// this is the original size frame
self.imageView.frame = smallFrame;


// somewhere in the code make a big frame and animate it
UIView animateWithDuration:1 animations^ { self.imageView.frame = bigFrame; }

但我想在视图控制器之间推送时为 UIView 组件设置动画

firstViewController pushViewController:secondViewController; // this should animate the frame size 
// of the imageView in the first view controller to the frame size of the imageView in the second 
//view contoller 

在 Facebook 应用中选择信息流或相册中的照片时,可以看到类似的行为。 背景变暗,图像变大。

我相信这是 2 个独立的视图控制器,因此推送期间的动画会让人感觉到帧大小的增长和缩小。这将有助于重用此图库视图控制器。

对于任何视图如何实现这一点?

【问题讨论】:

    标签: objective-c uiview uiviewcontroller uiviewanimation uiviewanimationtransition


    【解决方案1】:

    我相信您会想研究UIViewControllerAnimatedTransitioning 类。

    这是link on custom view controller transitions

    【讨论】:

    • 这个问题是 ios 7 之前的问题。谢谢!。我会接受的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-08
    • 2020-09-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多