Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.
Hi What i want to do is make a view appear on screen and when it does it will expand to 75,75 then shrink to 50,50 and repeat that 3 times over a period of 2 seconds.
Hi What i want to do is make a view appear on screen and when it does it will expand to 75,75 then shrink to 50,50 and repeat that 3 times over a period of 2 seconds.
This is how i am doing it and its not working. So can someone please help me understand why?
First of all, CATransformMakeScale takes scale numbers where 1.0 is 100% sized, .9 is 90% sized, 1.1 is 100% sized, etc. Using a scale of 75 would make the layer 75 TIMES larger than normal, which is likely not what you wanted.
This sort of thing is much easier and simpler with UIView animation.
Here's some code I wrote just the other day to make a button pulse from 100% to 110% size and back:
Just threw that code into my app to see what happens. it works as i need but the view never stops pulsing after a period of time. I need it to just pulse back and forth 3 times and then set it self in the middle of the screen then when the user taps the view again it will reverse and go away. I can figure it out eventually but can you please point me in the direction as to why my code did not work. Thanks.
Just threw that code into my app to see what happens. it works as i need but the view never stops pulsing after a period of time. I need it to just pulse back and forth 3 times and then set it self in the middle of the screen then when the user taps the view again it will reverse and go away. I can figure it out eventually but can you please point me in the direction as to why my code did not work. Thanks.
You need to add a call to the UIView class method setAnimationRepeatCount inside the animation block to set a repeat count. If you don't, it repeats forever.
From the docs:
setAnimationRepeatCount: Sets the number of times animations within an animation block repeat.
+ (void)setAnimationRepeatCount:(float)repeatCount Parameters repeatCount The number of times animations repeat. This value can be a fraction. If you specify the value 0, the animation is performed once without repeating. Discussion Use this method to specify the number of times to repeat the specified animations. This method does nothing if called from outside of an animation block. You can use this method in conjunction with either the block-based methods or the begin/commit methods for defining an animation block. If you do not explicitly set a repeat count, the animation is not repeated.
If you pass the UIViewAnimationOptionRepeat option to the animateWithDuration:delay:options:animations:completion: method without setting an explicit repeat count, the animation repeats indefinitely. If you want the animation to repeat a finite number of times, call this method from inside your block.
Regards,
Duncan C WareTo
Animated GIF created with Face Dancer, available for free in the app store.
Replies
This sort of thing is much easier and simpler with UIView animation.
Here's some code I wrote just the other day to make a button pulse from 100% to 110% size and back:
Duncan C
WareTo
Animated GIF created with Face Dancer, available for free in the app store.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeFrom the docs:
Duncan C
WareTo
Animated GIF created with Face Dancer, available for free in the app store.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeThanks!
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeDuncan C
WareTo
Animated GIF created with Face Dancer, available for free in the app store.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome