Sorry for a big question, real question are bold in bottom, now some explanation.
I\'m use CoreAnimation in my project for animate some objects moving l
You could use:
[UIView animateWithDuration:duration animations:^ {
[scrollView setContentOffset:destination animated:NO];
}];
You can set the duration of the animation this way.
[UIScrollViewNameHere setContentOffset:CGPointMake(x value of where you want to move to, y value of where you want to move to) animated:YES];
for example:
UIScrollView *scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(4, 2, 2341, 412)];
[scroll setContentOffset:CGPointMake(320, 0) animated:YES];
I don't think so that you can animate the point with CoreAnimation.
But you can try setContentOffset:animated:
thats the method you are searching for?
You can transform only following properties of UIView
more Information of the CoreAnimation
about animation checkout the Apple Documentation
You should read about animatable properties, Programming iOS 5
Indeed, when you try to animate layers, Apple gives a set of animatable properties, but you're not limited to this set. You can animate whatever you want.
In all cases, you shouldn't use kCAFillModeForwards
because it will ask the device to redraw forever the last presentation layer that was used for the animation, instead of using a cached representation of the layer.
So the way you could achieve such a thing would be by defining a specific layer of yours where the contentOffset
property is defined as animatable. And in order to work, you should start by verifying what kind of top layer class is used by a scrollview, so that, by subclassing it and setting the wanted property (contentOffset
) animatable, and subclassing your scrollview by setting this layer as the top layer of the scrollview, you could possibly achieve what you're trying to do.
This is theory!
But this is what I would try. Look for this method and its behavior and intents
+ (BOOL)needsDisplayForKey:(NSString *)key
Another thing you could read is this A start example. But this also means you should redraw your uiscrollview by yourself!