{"id":16682311,"url":"https://github.com/jpsim/uicollectionview-animation-bug","last_synced_at":"2026-04-25T12:37:05.293Z","repository":{"id":8961305,"uuid":"10700896","full_name":"jpsim/UICollectionView-Animation-Bug","owner":"jpsim","description":"There's a confirmed bug in UICollectionView. This project highlights a workaround.","archived":false,"fork":false,"pushed_at":"2013-06-26T04:54:04.000Z","size":372,"stargazers_count":33,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-09T23:12:52.870Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jpsim.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-06-15T01:48:14.000Z","updated_at":"2021-05-13T21:00:50.000Z","dependencies_parsed_at":"2022-09-18T15:10:30.648Z","dependency_job_id":null,"html_url":"https://github.com/jpsim/UICollectionView-Animation-Bug","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpsim%2FUICollectionView-Animation-Bug","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpsim%2FUICollectionView-Animation-Bug/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpsim%2FUICollectionView-Animation-Bug/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpsim%2FUICollectionView-Animation-Bug/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jpsim","download_url":"https://codeload.github.com/jpsim/UICollectionView-Animation-Bug/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248125589,"owners_count":21051770,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T14:07:00.224Z","updated_at":"2026-04-25T12:37:05.180Z","avatar_url":"https://github.com/jpsim.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Collection View Animation Bug Sample Code\n\n## The bug\n\nThere's a bug (confirmed by Apple) in the otherwise excellent `UICollectionView`'s `performBatchUpdates` method which causes cells that are initially off-screen animating on-screen to just appear at their final location instead of animating there. This is better understood visually:\n\n![Video of bug](UICV_Animation_Bug.gif)\n\nNotice how the last cell doesn't animate when reappearing? This is a simple demo, but there are cases in which the bug is drastically more jarring.\n\n## The demo project\n\nThis demo project is the result of having tried tons of work-arounds to get this animation to work, when finally the best solution was the crudest.\n\n## The fix\n\nThe solution is really more of a hack: make the collection view bigger during the animation so that it can accurately animate the appearing cells.\n\nEssentially:\n\n``` objc\nframeUpdate.size.height += kExpandedHeight - kCollapsedHeight;\ncollectionView.frame = frameUpdate;\n\n[collectionView performBatchUpdates:^{\n\t_cells[indexPath.item] = @(newHeight);\n} completion:^(BOOL finished) {\n    frameUpdate.size.height -= kExpandedHeight - kCollapsedHeight;\n    collectionView.frame = frameUpdate;\n}];\n```\n\n## License\n\nFeels weird to license something so small, but this demo is MIT licensed.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpsim%2Fuicollectionview-animation-bug","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjpsim%2Fuicollectionview-animation-bug","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpsim%2Fuicollectionview-animation-bug/lists"}