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 111649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:25:10+00:00 2026-05-11T02:25:10+00:00

Right, I’m trying to get a label with text in it (done already obviously),

  • 0

Right, I’m trying to get a label with text in it (done already obviously), which scrolls across the screen.

The text that is input into the label is done by a UITextField and a UIButton. This updates fine.

But I’m trying to get the UILabel to resize accordingly to the amount of text input, so that the WHOLE lot of text scrolls across the screen.

This is the code I have at the moment for the scrolling label:

[lblMessage setText: txtEnter.text];  CABasicAnimation *scrollText;  scrollText=[CABasicAnimation animationWithKeyPath:@'position.x']; scrollText.duration = 3.0; scrollText.repeatCount = 10000; scrollText.autoreverses = NO; scrollText.fromValue = [NSNumber numberWithFloat:500]; scrollText.toValue = [NSNumber numberWithFloat:-120.0];  [[lblMessage layer] addAnimation:scrollText forKey:@'scrollTextKey']; 

The problem is, sometimes is starts scrolling in the middle of the screen, and sometimes vanishes before it has fully gone acrosss.

It also cuts of text due to the label being one size.. I don’t know how to change this.

Thanks in advance.

Dom

  • 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. 2026-05-11T02:25:10+00:00Added an answer on May 11, 2026 at 2:25 am

    I believe something similar to the solution for this question would work for this case.

    You could embed the UILabel in a UIScrollView, with the UIScrollView set to the max size of the label that you want to display on the screen at one time. The UIScrollView would need to have its scroll indicators turned off using its showsHorizontalScrollIndicator and showsVerticalScrollIndicator properties. On a change of text, you could do the following:

    [lblMessage setText: txtEnter.text]; [lblMessage sizeToFit]; scrollView.contentSize = lblMessage.frame.size; 

    followed by the panning animation code as described in the above-linked question, with the frame to be panned to being the far right of the UILabel. This would cause the text to scroll at a constant rate across the label. If you want the label to scroll back to the beginning, you could use the UIView setAnimationRepeatAutoreverses: and setAnimationRepeatCount: methods in the beginning of your animation block.

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

Sidebar

Related Questions

Right what I was trying to do is validate some input so that the
Right now I have a script that will get the last five files in
Right now I am only trying to get my getline() function to work. I
Right now, I've just some code which fetches the picture from the URL directly.
Right now, the label for my Activity has the name of the current Activity.
Right now I have a function, in a class that is used to listen
Right now I came across the Observer/Observable pattern where I have my Observable notify
Right now I have an application that loads a bunch of thumbnail images into
Right now I've programmed a method for use in a swing program that is
Right now I am not specifying it and the system is defaulting to text/html

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.