Please note, this blog entry is from a previous course. You might want to check out the current one.
Animate the removal of matched cards. UICollectionView will do this for you if you call the deleteItemsAtIndexPaths: method. Just remember that at any time you call deleteItemsAtIndexPaths:, the UICollectionView’s dataSource (your Controller on behalf of your Model) must be in the state that will exist after the deletion happens. Otherwise you will crash with an assertion in the delete (because it will delete the items and try to reset everything and the new state of the UICollectionView will not match its dataSource’s idea of things). You can animate the dealing of 3 new cards as well using insertItemsAtIndexPaths: (though that animation is just “dissolving in” the new cards … deletion is far more exciting).
The first part – animating the removal or cards – is already implemented. A simpler solution would have been just to call reloadData after the data source was adjusted …
Continue reading “cs193p – Assignment #3 Extra Task #1”