I have a question. I want to display the user some content in a scrollview. I want to autoscroll the scrollview fast from left to right. I tried to use DDAutoscrollview (If someone knows), but it doesnt work for me. Do have someone a solution for me to autoscroll a Uiscrollview horizontaly? I've settet up a pagecontrol for the scrollview, because it uses paging. Any code snippets would be nice.
My code (Just of the Scrollview):
.h
@interface Interface1 : UIViewController {
IBOutlet UIScrollView *scroller;
}
.m
- (void)viewDidLoad
{
[scroller setScrollEnabled:YES];
[scroller setContentSize:CGSizeMake(960, 230)];
[super viewDidLoad];
}
I'm using Storyboards and ARC.
Thanks
I don't know how fast exactly but have you tried this method?
You don't need to use any extra libraries for this. UIScrollView has a
contentOffset
property on which you can simply set the animated flag to YES:Or you could wrap it in a UIView animation:
Either way, you'll probably want to set the contentSize of the scroll view to at least 640 wide so you can actually page.
You're looking for
- (void)scrollRectToVisible:(CGRect)rect animated:(BOOL)animated
. It will allow you to give it a rect inside your contentSize and it will scroll to it.http://developer.apple.com/library/ios/#documentation/uikit/reference/UIScrollView_Class/Reference/UIScrollView.html