UIImageView中的UIImageView动画停止 [英] UIImageView Animation Stopping in UITableView

查看:74
本文介绍了UIImageView中的UIImageView动画停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在UITableViewCell中有一个UIImageView.UIImageView具有动画效果.出于某种奇怪的原因,当单元格消失时,动画将停止.从不再次初始化UIImageView,也从未明确告知UIImageView-(void)stopAnimating;所以我不确定为什么会停止.

I have a UIImageView inside of a UITableViewCell. The UIImageView animates. For some odd reason, when the cell goes out of view, the animation stops. The UIImageView is never initialized again and the UIImageView is never explicitly told to - (void)stopAnimating; so I'm not sure why it's stopping.

这是我的cellforRowAtIndexPath:中有趣的部分.

Here's the interesting parts of my cellforRowAtIndexPath:. As you can

cell = (BOAudioCell *)[tableView dequeueReusableCellWithIdentifier:AudioCellIdentifier];
if (!cell) {
    cell = [[[BOAudioCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:AudioCellIdentifier] autorelease];
    BOPlayControl *playControl = [(BOAudioCell *)cell playControl];
    [[playControl playbackButton] addTarget:self action:@selector(playbackButtonTapped:) forControlEvents:UIControlEventTouchUpInside];
}

int index = [indexPath row];

BOModel *model = [models objectAtIndex:index];
[[(BOAudioCell *)cell titleLabel] setText:[model title]];
[[(BOAudioCell *)cell favoriteButton] addTarget:self   action:@selector(favoriteButtonTapped:) forControlEvents:UIControlEventTouchUpInside];

如您所知,我没有为单元格设置适当的动画起点,因为没有UIImageView的内置方式.

As you can tell, I'm not setting the appropriate animation begin point for the cell because there is not a built in way with a UIImageView.

推荐答案

我写了一个解决方法.我只是使用NSTimer来手动协调UIImageView的动画.效果很好.

I wrote a workaround. I'm just using a NSTimer to coordinate manually animating the UIImageView. It works great.

这篇关于UIImageView中的UIImageView动画停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆