UIView Animation Inconsistent Result

Posted by Josh Kahane on Stack Overflow See other posts from Stack Overflow or by Josh Kahane
Published on 2012-11-14T22:57:53Z Indexed on 2012/11/14 22:59 UTC
Read the original article Hit count: 307

Filed under:
|
|
|

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.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about animation