工具栏下方的 UIImageView CurlUp 过渡

发布于 2024-10-14 02:36:02 字数 1611 浏览 6 评论 0原文

我目前正在致力于在 iPad 应用程序中实现幻灯片控件。

我想管理图像之间不同类型的过渡,特别是 UIViewAnimationOptionTransitionCurlUp

我的 ViewController 的 xib 由两个叠加的 UIImageView 组成,两个 UIImageView 上有一个 UIToolbar ,以便为用户提供播放/暂停控制。

它是这样的: 在此处输入图像描述

我今天面临这样的问题:当我的两个 UIImageViews 之间发生 CurlUp 转换时,我也看到 UIToolbar (通常位于其他两个视图之上)动画: 在此处输入图像描述

这是我的转换代码的样子:

if ([slideshow.images count] <= 1)
{
    return;
}
currentImageIndex = ((currentImageIndex + 1) >= [slideshow.images count]) ? 0 : currentImageIndex + 1;

//imageStackView contains the two UIImageViews bound as IBOutlets from my xib
UIImageView *loadingImageView = [imageViewStack objectAtIndex:1];
loadingImageView.image = [slideshow.images objectAtIndex:currentImageIndex];
UIImageView *currentImageView = [imageViewStack objectAtIndex:0];

[UIView transitionFromView:currentImageView
                    toView:loadingImageView
                  duration:slideshow.duration
                   options:UIViewAnimationOptionTransitionCurlUp
                completion:^(BOOL finished) {
                      UIImageView *swap = [imageViewStack objectAtIndex:0];
                      [self.view bringSubviewToFront:toolbar];
                      [imageViewStack removeObjectAtIndex:0];
                      [imageViewStack addObject:swap];
                      [self scheduleNextAnimation];
        }];

如果您对此有任何想法,请告诉我!

提前致谢 !

I am currently working on the implementation of a slideshow control in an iPad application.

I would like to manage different kinds of transitions between the images, particularly the UIViewAnimationOptionTransitionCurlUp.

My ViewController's xib is composed of two superposed UIImageViews, with a UIToolbar over the two UIImageViews in order to give the user a play/pause control.

Here is how it looks like :
enter image description here

I today face the problem that when the CurlUp transition occurs between my two UIImageViews, I see the UIToolbar (which is normally over the two other views) animate as well :
enter image description here

Here is how my transition code looks like :

if ([slideshow.images count] <= 1)
{
    return;
}
currentImageIndex = ((currentImageIndex + 1) >= [slideshow.images count]) ? 0 : currentImageIndex + 1;

//imageStackView contains the two UIImageViews bound as IBOutlets from my xib
UIImageView *loadingImageView = [imageViewStack objectAtIndex:1];
loadingImageView.image = [slideshow.images objectAtIndex:currentImageIndex];
UIImageView *currentImageView = [imageViewStack objectAtIndex:0];

[UIView transitionFromView:currentImageView
                    toView:loadingImageView
                  duration:slideshow.duration
                   options:UIViewAnimationOptionTransitionCurlUp
                completion:^(BOOL finished) {
                      UIImageView *swap = [imageViewStack objectAtIndex:0];
                      [self.view bringSubviewToFront:toolbar];
                      [imageViewStack removeObjectAtIndex:0];
                      [imageViewStack addObject:swap];
                      [self scheduleNextAnimation];
        }];

Please let me know if you have any idea about this !

Thanks in advance !

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清音悠歌 2024-10-21 02:36:02

我通过将笔尖中的两个 UIImageView 附加到父 UIView 中解决了这个问题。
结果,我有一个视图层次结构如下:

  • UIView
    • UIView(UIImageView 的父视图)
      • UIImageView
      • UIImageView
    • UI工具栏

I solved this problem by appending the two UIImageViews in my nib in a parent UIView.
As a result, I have a view hierarchy as following :

  • UIView
    • UIView (parent view for UIImageViews)
      • UIImageView
      • UIImageView
    • UIToolbar
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文