我具有由图像的阵列,在其上我然后运行的动画延迟上在IOS
[myUIImageView startAnimating]
我希望动画一旦运行,则停止对3秒,然后重复。
我需要运行这个动画在一个单独的线程,这样我在viewDidLoad中有
NSThread *animationThread = [[NSThread alloc] initWithTarget:self selector:@selector(startAnimTask) withObject:nil waitUntilDone:NO];
[animationThread start];
,然后
-(void) startAnimTask {
//create array of images here; animationDuration (3) and animationRepeatCount (1)
[self setUpAnimation];
while (true){
[myUIImageView startAnimating];
usleep(3);
[myUIImageView stopAnimating];
usleep(3);
}
}
使用这种方法,我收到一个内存警告。我也试过在MainThread上运行启动和停止,但没有运气。
任何想法?
如果不是这种是performSelectorOnMainThread?它似乎不工作,只是执行选择器 –
什么//重复然后参考? –