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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:09:32+00:00 2026-05-22T16:09:32+00:00

I am working on a view that displays a grid of core animation layers.

  • 0

I am working on a view that displays a grid of core animation layers. When I remove a layer I want that layer to fade out and have the other layers move to fill the gap. This almost works the way I want it to using implicit animations. The only problem is that the layers that should move fade out while a copy of those layers move to the new position. How can I change that behavior so that layers just move instead of move and fade?

To remove a single layer I just do [theLayer removeFromSuperLayer] and then call my layout routine on the container layer which does this:

CGFloat x = 0;
CGFloat y = CGRectGetMaxY( [layer bounds] ) - buttonHeight - buttonVPadding;
for (CALayer *l in [layer sublayers]) {
    if ([layer bounds].size.width < x + buttonWidth) {
        x = 0;
        y -= buttonHeight + buttonVPadding;
    }
    CGRect bounds = CGRectMake( 0, 0, buttonWidth, buttonHeight );
    [l setBounds: bounds];
    [l setPosition: CGPointMake( x, y )];
    x += buttonWidth + buttonVPadding;
}

I tried overriding the default animation behavior in - (id<CAAction>)actionForLayer:(CALayer *)layer forKey:(NSString *)event; but I couldn’t find out which events to override to get the desired behavior.

  • 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-22T16:09:33+00:00Added an answer on May 22, 2026 at 4:09 pm

    After typing this question and thinking some more about the problem I found a solution or workaround. Instead of directly removing a layer I set it to hidden and skip hidden layers in my layout loop. Then after all the animations are done (in the completion block of my CATransaction) I remove all the hidden layers without animation.

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

Sidebar

Related Questions

I'm working on a grid view that will display cells that will have some
I have a View set to grab the latest forum posts. That's working fine,
I have a page that can be viewed by list or grid view through
I have a Rad Grid View that I'm using to display some data and
I have HandleError attribute working normally, however: I have a jqueryui dialog that displays
I have a foreach loop in my view that is not working correctly. My
I am working on a view that selects an image (chart) based on user
I am working with an edit user view that includes First name, Last Name,
I'm working on a swing app that will allow users to view sets of
I'm working on a page that, when I load into IE8 and view the

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.