I am new to iPhone development .Need help.I am developing iPhone app which contain UITextview,I want count the textview’s words not use textview.text.length, just words count.
and I want the textview auto scroll in one minute
-(IBAction)startbutton:(id)sender{
timer = [NSTimer scheduledTimerWithTimeInterval:0.1
target:self
selector:@selector(updateScroll)
userInfo:nil
repeats:YES];
self.startingTime = [NSDate date];
}
-(void)updateScroll
{
double noSeconds = (double) [self.startingTime timeIntervalSinceNow] /60;
frtextview.contentOffset = CGPointMake(0,noSeconds * frtextview.contentSize.height);
}
Above code can auto scroll, but the textview scroll from down to top,Iwant it from top to down,I hope you can help me find which code have problem.Thank you for your help
NSScanner could be used to do a words count, scan for white-space and count number of occurrences should work.
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSScanner_Class/Reference/Reference.html
If you simply negate your contentOffset I would think that would reverse the direction of your scrolling.
Here’s a simple example:
I got the original code here where there is a lot more detailed discussion:
http://hintsforums.macworld.com/archive/index.php/t-26871.html