UIView Animation Inconsistent Result
- by Josh Kahane
I am trying to make use of UIView animation to slide my views across the screen. I have a UIScrollView in my view controller, in which I have my UIViews.
I alos have this method:
-(void)translateView:(UIView *)view toRect:(CGRect)rect withDuration:(CGFloat)duration
{
[UIView animateWithDuration:duration
animations:^
{
view.frame = rect;
}
completion:^(BOOL finished)
{
//Finished
}];
}
I call this to move my UIView in an animated fashion to a CGRect of my choice over a certain time. I have a loop which creates and slides out 7 views. This works great, I call it like below, the loop of course calling this 7 times on different views:
[self translateView:cell toRect:translationRect withDuration:0.7];
However, I can't then call this again immediately afterwards, just nothing happens. Although, lets say I call this again after a 2 second NSTimer, the animation does run, but then when i scroll my UIScrollView, the view I just animated jumps back to its previous CGRect.
Hope you can help, its all feeling very un-explanetory, Ill post more code if it isn't making any sense, thanks.