【问题标题】:iPhone trash can suck animationiPhone垃圾桶可以吸动动画
【发布时间】:2011-04-20 21:04:20
【问题描述】:

我正在尝试在我正在构建的 iPhone 应用程序中使用垃圾桶动画。我知道我需要帮助的功能是私有 API,但该应用程序将在内部进行。

根据iPhoneDevWiki at the toolbar page,您可以使用[UIToolbar animateToolbarItemIndex:duration:target:didFinishSelector:]; 激活垃圾桶打开动画。

在尝试使用这种方法无数小时后,我无法让它发挥作用。到目前为止,我已将其更改为以下内容:[toolbar animateToolbarItemIndex:1 duration:1.0 target:self didFinishSelector:@selector(done:)];

toolbar 是我使用CGRectMake 以编程方式创建的UIToolbar 的名称。

我的垃圾桶按钮图像是 1,因为它是第二个按钮。

我尝试将selfnil 放入target,但它不起作用。

didFinishSelector 只是链接到-(void)done:(id)sender;

如果我将animateToolbarItemIndex 更改为不存在的东西,控制台会说它不存在。对我的错误有什么想法吗?

【问题讨论】:

  • animateToolbarItemIndex 似乎不是公共 API 的一部分。看看这个答案:stackoverflow.com/questions/428110/…
  • 谢谢。我知道它是一个私有 API,但我想在内部应用程序中使用它。我已经让吸吮动画工作了,但我需要帮助才能使用垃圾桶动画。有人可以解释一下它是如何使用的并举个例子吗?

标签: iphone animation bin recycle-bin


【解决方案1】:

垃圾桶动画适用于一系列图像,每个图像的盖子关闭/打开更多一点。所以你会做这样的事情:

UIImageView* trashCan = [[UIImageView alloc] initWithFrame:self.view.frame];
trashCan.animationImages = [NSArray arrayWithObjects:UIIMAGES, nil];
trashCan.animationDuration = 1.00;
trashCan.animationRepeatCount = 1;
[trashCan startAnimating];
[self.view addSubview:trashCan];

如果你有谷歌,我相信你能找到要使用的垃圾桶图片。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-03-27
    • 2013-09-07
    • 1970-01-01
    • 2011-02-09
    • 2010-09-30
    • 1970-01-01
    • 2020-04-25
    • 2013-08-10
    相关资源
    最近更新 更多