tags:

views:

246

answers:

2

I have a UITextView that has a lot of content (e.g. credit view), and I want to create an automatic scrolling view for it (something like the credits page for Firefox) where it automatically scrolls the names

I have tried the following, but it is not smooth, and I also require it to happen automatically when user goes to that view

CGPoint scrollPoint = textView.contentOffset;

scrollPoint.y= scrollPoint.y+10;

[textView setContentOffset:scrollPoint animated:YES];

Any guidance?

+1  A: 

Since UITextView is a subclass of UIScrollView, you can use its scrollRectToVisible:animated: method to scroll with animation to any point you wish.

The PageControl sample code demonstrates its use (although it's scrolling horizontally).

Shaggy Frog
A: 

Till now i hv done dis bt still it is not smooth?????????

Any sugestion???

  • (void)viewDidLoad {

    [super viewDidLoad];

[self run];

}

-(void)run{

CGRect Frame1 = CGRectMake(5.0,5.0, 100.0,400.0);
CGPoint scrollPoint = textView.contentOffset;

scrollPoint.y= scrollPoint.y+100;

[textView setContentOffset:scrollPoint animated:YES];

[textView scrollRectToVisible:Frame1 animated:YES];
NSTimer *time;
time=[NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(run) userInfo:nil repeats:YES];

}

raaz