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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:26:50+00:00 2026-05-28T19:26:50+00:00

I’m reading through Apple’s documentation on CA, and I was trying to do a

  • 0

I’m reading through Apple’s documentation on CA, and I was trying to do a simple animation. I am wondering why this does not work:

CABasicAnimation *goRight = [CABasicAnimation animationWithKeyPath:@"position"];
goRight.duration = 5;
goRight.fromValue = [NSValue valueWithCGPoint:CGPointMake(0, 0)];
NSLog(@":%@", [goRight.fromValue description]);
goRight.toValue = [NSValue valueWithCGPoint:CGPointMake(100, 100)];
CALayer *thelayer = [CALayer layer];
[thelayer addAnimation:goRight forKey:nil];
[self.aView.layer addSublayer:thelayer];

but if I change the last few lines to:

//    CALayer *thelayer = [CALayer layer];
//    [thelayer addAnimation:goRight forKey:nil];
//    [self.aView.layer addSublayer:thelayer];
    [self.aView.layer addAnimation:goRight forKey:nil];

this works. I thought I read somewhere on SO that either implicit or explicit animations were off on the .layer property so I thought I should get in the practice of adding a sublayer to the main .layer property and have the animation act on that layer.

Can someone help explain what I am doing wrong? Thanks.

  • 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-28T19:26:53+00:00Added an answer on May 28, 2026 at 7:26 pm

    You’re creating a brand new layer with no content and giving it an animation. There are two problems:

    1. The layer is size 0×0 by default, and you don’t change its size. You need to make it bigger than 0×0 by setting either its frame or its bounds.
    2. The layer has no content or other properties that would make it visible. There are lots of ways to make it visible. One way is just to set its background color. For example:

      thelayer.backgroundColor = UIColor.redColor.CGColor;
      

    Also, when you add the animation to the layer, you should usually use the animated property name as the key. For example:

    [thelayer addAnimation:goRight forKey:@"position"];
    

    If you want to learn Core Animation, I highly recommend watching the WWDC videos. There are two videos, Core Animation in Practice parts 1 and 2, from WWDC 2010. There is one video, Core Animation Essentials, from WWDC 2011.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to loop through a bunch of documents I have to put
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,

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.