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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:06:44+00:00 2026-05-27T11:06:44+00:00

Has anyone had success applying animations to AQGridViewCell s? I’m trying to make every

  • 0

Has anyone had success applying animations to AQGridViewCells? I’m trying to make every cell but the first one fade away after a tap.

The problem is that when the fade begins, the cell contents usually get swapped around. For example if the first row of the grid view has cells with labels “1”, “2”, “3”, then the labels might get swapped to “1”, “3”, “2”.

- (AQGridViewCell *)gridView:(AQGridView *)aGridView cellForItemAtIndex:(NSUInteger)index
{
    static NSString *CellIdentifier = @"ReusableGridViewCell";

    AQGridViewCell *cell = (AQGridViewCell *)[gridView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil)
    {
        [[NSBundle mainBundle] loadNibNamed:@"ReusableGridViewCell" owner:self options:nil];

        cell = [[[AQGridViewCell alloc] initWithFrame:gridViewCellContent.frame
                                      reuseIdentifier:CellIdentifier] autorelease];
        UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
        [cell.contentView addSubview:label];
        [label release];

        cell.selectionStyle = AQGridViewCellSelectionStyleNone;
    }

    UILabel *label = [[cell.contentView subviews] objectAtIndex:0];
    if (! tapped)
    {
        label.text = [NSString stringWithFormat:@"%u", index];
    }   
    else if (index > 0)
    {
        CATransition *cellAnimation = [CATransition animation];
        cellAnimation.duration = 3.0;
        cellAnimation.type = kCATransitionFade;
        cellAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];
        [label.layer addAnimation:cellAnimation forKey:kCATransition];              // labels get swapped
//      [cell.contentView.layer addAnimation:cellAnimation forKey:kCATransition];   // labels get swapped
//      [cell.layer addAnimation:cellAnimation forKey:kCATransition];               // labels get swapped, one cell immediately disappears
        NSLog(@"%u", [gridView isAnimatingUpdates]);                                // prints "0"

        label.hidden = YES;
    }

    return cell;
}

- (void)gridView:(AQGridView *)aGridView didSelectItemAtIndex:(NSUInteger)index
{
    tapped = YES;
    [gridView reloadData];
}

I tried setting breakpoints in a bunch of AQGridView, AQGridViewCell, etc. methods to try to find the one that causes the swap. Couldn’t find it.

In the known bugs of AQGridView, there is this:

Don’t try to pile multiple animations on top of one another. i.e.
don’t call -beginUpdates on a grid view whose -isAnimatingUpdates
method returns YES. Bad things will happen, cells will end up in the
wrong places, stacked on top of one another.

In the above code, -isAnimatingUpdates returns NO. Even so, perhaps what I’m seeing is another related bug in AQGridView — I’ll be submitting a bug report. But since mine is such a simple case I’m wondering if somebody has encountered it before and figured out a workaround, perhaps some way to turn off the animations inside of AQGridView.

Edit

To see if the problem was related to the hidden property, I instead animated the cell’s opacity (tried both approaches described here). Even when opacity only goes down to 0.5 instead of 0.0, the cells are still swapping.

  • 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-27T11:06:45+00:00Added an answer on May 27, 2026 at 11:06 am

    Here’s a workaround. If anyone finds a more elegant solution I will mark it as the answer.

    - (void)gridView:(AQGridView *)aGridView didSelectItemAtIndex:(NSUInteger)index
    {
        // Create a copy of the 0th cell's content and display it on top of that cell.
        AQGridViewCell *selectedCell = [aGridView cellForItemAtIndex:0];
        UILabel *selectedLabel = [[selectedCell.contentView subviews] objectAtIndex:0];
        CGRect frame = [self.view convertRect:selectedLabel.frame fromView:selectedLabel.superview];
        UILabel *labelOnTop = [[UILabel alloc] initWithFrame:frame];
        labelOnTop.text = selectedLabel.text;
        [self.view addSubview:labelOnTop];
        [labelOnTop release];
    
        // Fade away the grid view as a whole (not individual cells). 
        CATransition *cellAnimation = [CATransition animation];
        cellAnimation.duration = 3.0;
        cellAnimation.type = kCATransitionFade;
        cellAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];
        [aGridView.layer addAnimation:cellAnimation forKey:kCATransition];
        aGridView.hidden = YES;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Has anyone had success compiling QJson statically into an application? I am trying to
Has anyone had a problem running Clojure Box in Windows 7? I am trying
Has anyone had this unusual(recurring) experience before? I'm trying to check out the project
Has anyone had success setting up Flask project in WingIDE so that you can
Has anyone had success making an msbuild file that will publish a Web Application,
Folks: Has anyone had success connecting to a Progress-4GL database with Delphi ?  
Has anyone had much success with RequireJS and Ember.js? Seeing as Ember likes to
Has anyone had success with Dragon Naturally Speaking voice recognition software when it comes
Has anyone had success in resubscribing an email address after being unsubscribed via the
Has anyone had success developing a substantial Android app in Scala? Is it a

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.