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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:50:00+00:00 2026-06-13T02:50:00+00:00

I have a collection view whose layout is managed by a UICollectionViewFlowLayout instance. I

  • 0

I have a collection view whose layout is managed by a UICollectionViewFlowLayout instance. I have a long press gesture recognizer attached to the collection view whose job is to detect if a long press occured within the bounds of one of the cells in the collection view and if so, delete that cell after changing the cell’s transform animatedly.

This is the relevant part of the action performed by the gesture recognizer:

UICollectionViewCell *cell = [self.collectionView cellForItemAtIndexPath:indexPath];
[UIView animateWithDuration:2.0 animations:^{
    cell.layer.transform = CATransform3DMakeScale(1.0, 0.0, 1.0); // an example animation - squish the cell vertically

} completion:^(BOOL fin) {
     //[cell.layer removeAllAnimations];
     [self.model.numb3rs removeObjectAtIndex:[indexPath row]]; // update model
     [self.collectionView deleteItemsAtIndexPaths:[NSArray arrayWithObject:indexPath]]; // delete item
 }];

The problem is that the deletion method seems to perform its own property change/animation on the cell which doesn’t gel well with my animation. For instance, in the effect I’m trying to achieve here, once the cell is completely squished vertically, I’d like it not to show itself in the view again, but the deleteItemsAtIndexPaths: call causes the cell’s “ghost” to show up and then fade out as the method performs its own transform and opacity animation.

Am I approaching it completely wrong? Possibly the collection view architecture offers a better way to do what I want, rather than explicitly animating the cell and then deleting it like I’m trying?

I’m hoping I might be able to get a quick answer here rather than have to dig into the documentation too deep.

  • 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-06-13T02:50:02+00:00Added an answer on June 13, 2026 at 2:50 am

    I asked this question on the Apple Developer Forums, and was informed of the

    -finalLayoutAttributesForDisappearingItemAtIndexPath:

    method which is part of the UICollectionViewLayout class.

    Anyway, by subclassing UICollectionViewFlowLayout and overriding this method, I was able to modify the attributes of the cell I was deleting – in particular, the transform.

    One thing to note is that this method gets called not only for the cell being deleted but also for cells being shifted from their position during the relayout. But it’s simple enough to write code to keep track of the cell being deleted and only modified its attributes.

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

Sidebar

Related Questions

I have a list view that displays a collection of items, each item has
I have a Backbone View that has a Collection as its Model. If the
I have a view that's doing a fetch() to a collection and returning some
I use backbone.js and have a model without a collection. In the view I
I have an application where I have a main viewmodel whose view contains a
I have a listbox bound to a view model observable collection: This works fine,
I have an app delegate, whose default view should be preceeded by a modal
I have a C# WinForms Application with a Collection (ArrayList) whose content I want
I have a complex view model which contains a collection of other objects which
In a view model, I have a collection of items of type ClassA called

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.