Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Repeat count for UIView block-based animation

I've looked at the methods for block based animation and noticed there is no equivalent parameter or option for [UIView setAnimationRepeatCount:].

What's the simplest way to repeat an animation a fixed number of times? Do you, for instance, chain them using the completion block?

like image 497
Mihai Damian Avatar asked Nov 01 '10 14:11

Mihai Damian


People also ask

Does UIView animate need weak self?

No, it is not needed in this case. animations and completion are not retained by self so there is no risk of strong retain cycle.

Does UIView animate run on the main thread?

The contents of your block are performed on the main thread regardless of where you call [UIView animateWithDuration:animations:] .

Is UIView animate asynchronous?

UIView. animate runs on the main thread and is asynchronous.


1 Answers

I just asked a similar question and then I read the 2010-11-15 release of the View Programming Guide for iOS. Page 64 caught my attention.

In the animation block, one can still use the [UIView setAnimationRepeatCount:]. I thought that I could/should not. So my ability to read Apple doc needs to improve.

So perhaps this would solve your (and my need). I'm trying it later today

like image 200
PommeOuest Avatar answered Sep 21 '22 13:09

PommeOuest