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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:16:04+00:00 2026-05-25T22:16:04+00:00

I actually stuck on a problem with animating a UILabel in my iOS Application.

  • 0

I actually stuck on a problem with animating a UILabel in my iOS Application.
After 2 days of searching the web for code snippets, still no result.

Every sample I found was about how to animate UIImage, adding it as a subview to UIView by layer. Is there any good example about animating a UILabel?
I found a nice solution for a blinking animation by setting the alpha property, like this:

My function:

- (void)blinkAnimation:(NSString *)animationID finished:(BOOL)finished target:(UIView *)target
{
    NSString *selectedSpeed = [[NSUserDefaults standardUserDefaults] stringForKey:@"EffectSpeed"];
    float speedFloat = (1.00 - [selectedSpeed floatValue]);

    [UIView beginAnimations:animationID context:target];
    [UIView setAnimationDuration:speedFloat];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector:@selector(blinkAnimation:finished:target:)];

    if([target alpha] == 1.0f)
        [target setAlpha:0.0f];
    else
        [target setAlpha:1.0f];
    [UIView commitAnimations];
}

Call my function on the UILabel:

[self blinkAnimation:@"blinkAnimation" finished:YES target:labelView];

But how about a Pulse, or scaling animation?

  • 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-25T22:16:05+00:00Added an answer on May 25, 2026 at 10:16 pm

    Unfortunately font size is not an animatable property of NSView. In order to scale a UILabel, you’ll need to use more advanced Core Animation techniques, using CAKeyframeAnimation:

    1. Import the QuartzCore.framework into your project, and #import <QuartzCore/QuartzCore.h> in your code.
    2. Create a new CAKeyframeAnimation object that you can add your key frames to.
    3. Create a CATransform3D value defining the scaling operation (don’t get confused by the 3D part–you use this object to do any transformations on a layer).
    4. Make the transformation one of the keyframes in the animation by adding it to the CAKeyframeAnimation object using its setValues method.
    5. Set a duration for the animation by calling its setDuration method
    6. Finally, add the animation to the label’s layer using [[yourLabelObject layer] addAnimation:yourCAKeyframeAnimationObject forKey:@"anyArbitraryString"]

    The final code could look something like this:

    // Create the keyframe animation object
    CAKeyframeAnimation *scaleAnimation = 
       [CAKeyframeAnimation animationWithKeyPath:@"transform"];
    
    // Set the animation's delegate to self so that we can add callbacks if we want
    scaleAnimation.delegate = self;
    
    // Create the transform; we'll scale x and y by 1.5, leaving z alone 
    // since this is a 2D animation.
    CATransform3D transform = CATransform3DMakeScale(1.5, 1.5, 1); // Scale in x and y
    
    // Add the keyframes.  Note we have to start and end with CATransformIdentity, 
    // so that the label starts from and returns to its non-transformed state.
    [scaleAnimation setValues:[NSArray arrayWithObjects:
                      [NSValue valueWithCATransform3D:CATransform3DIdentity],
                      [NSValue valueWithCATransform3D:transform],
                      [NSValue valueWithCATransform3D:CATransform3DIdentity],
                      nil]];
    
    // set the duration of the animation
    [scaleAnimation setDuration: .5];
    
    // animate your label layer = rock and roll!
    [[self.label layer] addAnimation:scaleAnimation forKey:@"scaleText"];
    

    I’ll leave the repeating “pulse” animation as an exercise for you: hint, it involves the animationDidStop method!

    One other note–the full list of CALayer animatable properties (of which “transform” is one) can be found here. Happy tweening!

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

Sidebar

Related Questions

I'm still stuck on my problem of trying to parse articles from wikipedia. Actually
i'm now stuck on this problem for days and i haven't been able to
Actually i am get stuck in a big problem..I have created an app from
I'm stuck with a problem how to check if a specific date is within
I am stuck with a small problem in PHP with string function. I'm fetching
I'm quite stuck with the following functor problem in OCaml. I paste some of
I have an odd problem. I have a unit test that keeps getting stuck
I'm having an interesting but difficult problem with my JavaScript code. Basically, I'm trying
i've been stuck on a problem and can't seem to find any help for
I hope this isn't too vague, but I'm stuck on a problem that has

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.