I am working in iPhone application, Using UITextView to show multiple text inside it, when the user tab the screen, automatically scroll UITextView content from bottom to top (scrolling level slow) and its working fine, i want to increase scroll speed like 1,2,3,4,5,6…10, How to do this? Please help me.
Thanks in advance
I tried this:
- (void)viewDidLoad
{
[super viewDidLoad];
ScriptDetails = [[UITextView alloc]initWithFrame:CGRectMake(0,9,480,285)];
ScriptDetails.text=Script;
ScriptDetails.textAlignment=UITextAlignmentLeft;
ScriptDetails.editable=NO;
ScriptDetails.delegate=self;
ScriptDetails.font=[UIFont fontWithName:str1 size:f];
ScriptDetails.backgroundColor=tColor1;
ScriptDetails.textColor=tColor;
[self.view addSubview:ScriptDetails];
UITapGestureRecognizer *singleTap = [[[UITapGestureRecognizer alloc] initWithTarget: self action:@selector(TouchToPlay)] autorelease];
singleTap.delegate=self;
singleTap.numberOfTapsRequired = 1;
[ScriptDetails addGestureRecognizer:singleTap];
}
-(void)TouchToPlay
{
NSLog(@"single");
timer = [NSTimer scheduledTimerWithTimeInterval:(35.0/1000.0)
target:self
selector:@selector(autoscrollTimerFired:)
userInfo:nil
repeats:YES];
}
- (void)autoscrollTimerFired:(NSTimer*)timer
{
CGPoint scrollPoint = ScriptDetails.contentOffset;
scrollPoint = CGPointMake(scrollPoint.x, scrollPoint.y + 1);
[ScriptDetails setContentOffset:scrollPoint animated:NO];
}
The other way is to put the variable in
- (void)autoscrollTimerFired:(NSTimer*)timermethodin
scrollPoint = CGPointMake(scrollPoint.x, scrollPoint.y + 1);line instead of just1put there some iVar instead and provide some mechanism for like say one+and-button to increase and decrease the speed.