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

  • SEARCH
  • Home
  • 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 7960915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:53:29+00:00 2026-06-04T04:53:29+00:00

UPDATED I want to make running text line, which way is better to make

  • 0

UPDATED
I want to make running text line, which way is better to make it?

 -(void)viewDidLoad
    {
         CGSize mySize = CGSizeZero;
            mySize = [kGrindFMRunningText sizeWithFont:[UIFont fontWithName:@"Verdana" size:16]  constrainedToSize:CGSizeMake(4000, 30) lineBreakMode:UILineBreakModeWordWrap];

        runningText = [[UIScrollView alloc] initWithFrame:CGRectMake(60, -5, 260, 50)];
            grind_fm_text = [[UILabel alloc] initWithFrame:CGRectMake(0, 15, mySize.width, 30)];
            [grind_fm_text setUserInteractionEnabled:NO];
            [grind_fm_text setBackgroundColor:[UIColor clearColor]];
            [grind_fm_text setTextColor:[UIColor whiteColor]];
            [grind_fm_text setFont:[UIFont fontWithName:@"Verdana" size:16]];
            [grind_fm_text setText:kGrindFMRunningText];
            [runningText addSubview:grind_fm_text];
            [grind_fm_text release];
            [self animate];
    }


       - (void)animate
{
    [UIView animateWithDuration:10.0 delay:0. options:UIViewAnimationOptionCurveLinear|UIViewAnimationOptionBeginFromCurrentState animations:^{
        grind_fm_text.frame = CGRectMake(-grind_fm_text.frame.size.width, 15, grind_fm_text.frame.size.width, grind_fm_text.frame.size.height);
        // Do your animation in one direction until text is gone
    } completion:^(BOOL finished){
        grind_fm_text.frame = CGRectMake(260, 15, grind_fm_text.frame.size.width, grind_fm_text.frame.size.height); 
        // Move scroll position back to original position
        [self animate]; // Then call animate again to repeat
    }];
}

-(void)songChange
{
    CGSize mySize = CGSizeZero;
    mySize = [result sizeWithFont:[UIFont fontWithName:@"Verdana" size:16]  constrainedToSize:CGSizeMake(4000, 30) lineBreakMode:UILineBreakModeWordWrap];
    grind_fm_text.frame = CGRectMake(grind_fm_text.frame.origin.x, 15, mySize.width, 30);
    grind_fm_text.text = result;;
    [self animate];
}

- (void)startStopStream {
        [streamer stop];
        //[bufferIndicator stopAnimating];
        [CATransaction begin];
        [self.view.layer removeAllAnimations];
        [CATransaction commit];
        grind_fm_text.text = kGrindFMRunningText;
        CGSize mySize = CGSizeZero;
        mySize = [kGrindFMRunningText sizeWithFont:[UIFont fontWithName:@"Verdana" size:16]  constrainedToSize:CGSizeMake(4000, 30) lineBreakMode:UILineBreakModeWordWrap];
        grind_fm_text.frame = CGRectMake(grind_fm_text.frame.origin.x, 15, mySize.width, 30);
        [self animate];
}

[CATransaction begin]; [myView.layer removeAllAnimations]; [CATransaction commit]; doesn’t work for me. UIViewAnimationOptionCurveLinear|UIViewAnimationOptionBeginFromCurrentState works strangely: first, it doesn’t do completion block as i see, or maybe it does, but animation doesn’t start again. And If i click button nothing happening, but when i click it second time, animation begins from another direction and slows until freeze.

  • 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-06-04T04:53:30+00:00Added an answer on June 4, 2026 at 4:53 am

    You should be able to do this more simply with nested UIView animation blocks. In the animation block have it scroll in the one direction, in the completion block have it scroll in the other direction and in that animation’s completion block have it call your animate function over again so it repeats.

    Something like this:

    - (void)animate
    {
        [UIView animateWithDuration:10.0 delay:0. options:UIViewAnimationOptionCurveLinear animations:^{
            // Do your animation in one direction
        } completion:^(BOOL finished){
            [UIView animateWithDuration:10.0 delay:0. options:UIViewAnimationOptionCurveLinear animations:^{
                // Do your animation in the other direction
            } completion:^(BOOL finished){
                [self animate];
            }];
        }];
    }
    

    Or if you want it to scroll all the way across then do it again, something like:

    - (void)animate
    {
        [UIView animateWithDuration:10.0 delay:0. options:UIViewAnimationOptionCurveLinear animations:^{
            // Do your animation in one direction until text is gone
        } completion:^(BOOL finished){
            // Move scroll position back to original position
            [self animate]; // Then call animate again to repeat
        }];
    }
    

    It sounds like by default, animations use the UIViewAnimationOptionCurveEaseInOut animation option. You want the UIViewAnimationOptionCurveLinear option. I’ve updated my code above to include that.


    As per an answer to this question: Cancel a UIView animation? you should be able to cancel the animation by calling [myView.layer removeAllAnimations]; where myView is the scroll view being animated. Make sure to import <QuartzCore/QuartzCore.h> at the top to access CALayer methods.

    Edit: you may need to call it like this to make sure it runs immediately and not after the next runloop iteration:

    [CATransaction begin];
    [myView.layer removeAllAnimations];
    [CATransaction commit];
    

    Or if that still doesn’t work, then likely just changing the options parameters in the UIView method calls to UIViewAnimationOptionCurveLinear|UIViewAnimationOptionBeginFromCurrentState should work, with no need to call removeAllAnimations. In fact, try that first.

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

Sidebar

Related Questions

I want to add explicit lock on row which is currently being updated and
I'm really confused. I want to make a Chrome Extension that can update a
I want to create updated URL when Next 1000 button is clicked on the
I want to display the time and date of updated row from MySQL to
I want to access an array that is created and updated in the native
I want a validation to run before a record gets updated. I know of
I want to update my PHP GUI view when my data source is updated(data
If I want to keep an xml file updated with all the images that
I have a textbox and want an event triggered whenever it is updated, whether
I want to make a programm that works like an instant messenger and I´m

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.