【问题标题】:How to move UIView Animation to background?如何将 UIView 动画移动到背景?
【发布时间】:2013-01-10 15:02:15
【问题描述】:

我们的想法是在带有 4 或 5 条链接的仪表板上旋转图像。链接的 uiview 正在工作,uiview 的动画正在工作,在我将动画添加到应用程序之前,一切都很好,动画的图层在后面。现在,当我添加图像旋转的代码时,它会将动画图像放在其他图层的顶部,而不是留在后面。

我的 viewcontroller.m 文件中有此代码设置,它按预期工作。尽管我遇到的问题是 UIView 被绘制在其他视图之上,即使它位于底部

// 在破折号上旋转图像

    UIImageView *rotateImage = (UIImageView *)[self.view viewWithTag:88];
    rotateImage.animationImages = [NSArray arrayWithObjects:
                                   [UIImage imageNamed:@"c3_1.jpg"],
                                   [UIImage imageNamed:@"c3_5.jpg"],
                                   [UIImage imageNamed:@"c3_7.jpg"],
                                   [UIImage imageNamed:@"c3_8.jpg"],
                                   [UIImage imageNamed:@"c3_10.jpg"], nil];

    // all frames will execute in 1.75 seconds
    rotateImage.animationDuration = 10.75;
    // repeat the annimation forever
    rotateImage.animationRepeatCount = 0;
    // start animating
    [rotateImage startAnimating];
    // add the animation view to the main window
    [self.view addSubview:rotateImage];

**对于那些有这个问题的人来说很容易解决.. :)

大声笑..它正盯着我的脸..

在最后添加子视图是把它放在堆栈的顶部。删除了那条线,它现在可以正常工作了。

【问题讨论】:

  • 请将您的编辑作为答案并接受它,以便其他人知道此问题已解决。

标签: objective-c uiimageview


【解决方案1】:

它正盯着我的脸。在最后添加子视图是将其放在堆栈的顶部。

所以我将其添加为下一行。

[self.view sendSubviewToBack:rotateImage];

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-12
    相关资源
    最近更新 更多