Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6720233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:11:18+00:00 2026-05-26T09:11:18+00:00

I am new to iPhone development .Need help.I am developing iPhone app which contain

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T09:11:18+00:00Added an answer on May 26, 2026 at 9:11 am

    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.

    frtextview.contentOffset = CGPointMake(0, -(noSeconds * frtextview.contentSize.height));
    

    Here’s a simple example:

    -(unsigned) wordCount: (NSString *) textString 
    {
    NSScanner *wordScanner = [NSScanner scannerWithString: textString];
    NSCharacterSet *whiteSpace = [NSCharacterSet whitespaceAndNewlineCharacterSet];
    
    unsigned wordCount = 0;
    while ([wordScanner scanUpToCharactersFromSet: whiteSpace intoString: nil])
    {
    wordCount++;
    }
    
    return wordCount;
    }
    

    I got the original code here where there is a lot more detailed discussion:

    http://hintsforums.macworld.com/archive/index.php/t-26871.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I m new to iphone app development and i need some help. I have
I'm new to iPhone development, I need help. I want to download an XML
I am new in iPhone development. I need your help in sorting NSArray. in
I am new to iPhone development, I need to play videos which are on
I'm pretty new to iPhone development. I am building an app which has multiple
I am new to iPhone development. I have a application in which i need
I am really new to iPhone development and I need help setting up my
I am new to iphone development. I am developing an iphone application which contains
I am new to iphone development.. I am developing an iphone application in which
I'm pretty new to iPhone development but I'm close to releasing my first app

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.