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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:03:26+00:00 2026-05-25T12:03:26+00:00

I animate my UIImageView with CAAnimation using layer property like so: [imageView.layer addAnimation:pathAnimation forKey:[NSString

  • 0

I animate my UIImageView with CAAnimation using layer property like so:

    [imageView.layer addAnimation:pathAnimation forKey:[NSString stringWithFormat:@"pathAnimation%@",objId]];

But at the end of my animation (after object has moved from original point) when I read the frame’s X Y coordinates or center coordinates they always appear to be original ones, not those where the object has moved to.

How to read layer’s coordinates so I determine the correct location of my moving object?

Here is my code:

UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 50, 50)];  
imageView.image = [UIImage imageNamed:@"banner1.jpg"];
imageView.animationDuration = 2;
imageView.animationRepeatCount = 0;
imageView.tag = 100000;

imageView.layer.frame = imageView.frame;

[self.view addSubview:imageView];   
CAKeyframeAnimation *pathAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
pathAnimation.duration = 2.0f;
pathAnimation.delegate=self;
pathAnimation.calculationMode = kCAAnimationPaced;
pathAnimation.fillMode = kCAFillModeForwards;
pathAnimation.removedOnCompletion = NO; 
CGMutablePathRef pointPath = CGPathCreateMutable();
CGPathMoveToPoint(pointPath, NULL, 100, 100);
CGPathAddLineToPoint(pointPath, NULL, 300, 200);
CGPathAddLineToPoint(pointPath, NULL, 200, 150);
pathAnimation.path = pointPath;
CGPathRelease(pointPath);   
[imageView.layer addAnimation:pathAnimation forKey:@"pathAnimation"];
[imageView release];
  • 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-25T12:03:26+00:00Added an answer on May 25, 2026 at 12:03 pm

    If you animate layer, the view that contains layer will remain at same place so frame will remain same. layer also have frame, bound and position properties, so try reading properties of layer.

    EDIT:

    I found following explanation in CAKeyframeAnimation Class Reference.

    While animating, it updates the value of the property in the render tree with values calculated using the specified interpolation calculation mode.

    and for knowing what is render tree I found it here.

    http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreAnimation_guide/Articles/CoreAnimationArchitecture.html#//apple_ref/doc/uid/TP40006655-SW1

    Seems that values are getting updated in render tree and as render tree is different from presentation and private we cannot access it.

    Following is last paragraph of above link.

    You can query an instance of CALayer for its corresponding presentation layer while an animation transaction is in process. This is most useful if you intend to change the current animation and want to begin the new animation from the currently displayed state.

    Baseed on this a work around can be to calculate new position of layer based on the paths you provided and setting presentation layer frame property accordingly.

    Please write here in case you find any update…..

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

Sidebar

Related Questions

I need to animate the height attribute of iframe, but seems like the animate
I'm using CGAffineTransformRotate and CGAffineTransformTranslate to animate the progress of a car image (UIImageView)
I'm trying to animate a block level element using jQuery. The page loads with
Good day all; I have an UIImageView that I animate around a large UIView.
I have a UIImageView that I need to animate off the screen. I'm doing
i want to display an UIImage within a UIImageView but it doesn't work and
I have a UIScrollView that holds UIImageViews. I'd like to animate the transition between
I am trying to animate an image using following code: [UIView beginAnimations:nil context:NULL]; [UIView
I have a UIView that I would like to animate into the screen in
I have a UIImageView that I would like to change its image with animation.

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.