Spe*_*eed -1 animation ios ios5
我有一个由一系列图像组成的动画,然后我运行
[myUIImageView startAnimating]
Run Code Online (Sandbox Code Playgroud)
我希望动画运行一次,然后停止3秒,然后重复.
我需要在一个单独的线程中运行这个动画,所以我有
NSThread *animationThread = [[NSThread alloc] initWithTarget:self selector:@selector(startAnimTask) withObject:nil waitUntilDone:NO];
[animationThread start];
Run Code Online (Sandbox Code Playgroud)
在我的viewDidLoad中,然后
-(void) startAnimTask {
//create array of images here; animationDuration (3) and animationRepeatCount (1)
[self setUpAnimation];
while (true){
[myUIImageView startAnimating];
usleep(3);
[myUIImageView stopAnimating];
usleep(3);
}
}
Run Code Online (Sandbox Code Playgroud)
使用此方法,我收到内存警告.我也尝试过在MainThread上运行启动和停止而没有运气.
有任何想法吗?
做这个:
[myUIImageView startAnimating];
[self performSelector:@selector(startAnimTask)
withObject:nil
afterDelay:(myUIImageView.animationDuration+3.0)];
Run Code Online (Sandbox Code Playgroud)
现在选择器是:
-(void)startAnimTask
{
[myUIImageView startAnimating];
//repeat again then add above selector code line here
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1220 次 |
| 最近记录: |