I have a UITableViewController built into the UINavigationController, and I'm trying to implement Peek and Pop in a TableView. I have a โpeekโ part that works fine, but when I try to โpopโ in the next ViewController, the cells that I was โpeekingโ and the next cell are both shown. I โpop upโ in the UICollectionView, and, as I mentioned, the โpeekโ half shows the correct cell, but the โpopโ does not. This problem occurs when I use [self.navigationController showViewController:viewControllerToCommit sender:nil]; or [self.navigationController pushViewController:viewControllerToCommit animated:YES]; to execute "pop".
Here is a "Peek" showing the correct cell 
And "Pop" showing the wrong cell

I tried using [self presentViewController:viewControllerToCommit animated:YES completion:nil]; , and the correct cell is shown, except that it does not give me the navigation elements that I need, so I cannot use them (unless there is a way to get all the navigation elements back).
My initial thought was that something was wrong with how my application figures out the size of CollectionViewCell. Here is the code I use for this, although it seems to work correctly with everything except Peek and Pop.
-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { CGSize collectionViewBounds = collectionView.bounds.size; int navigationHeight = self.navigationController.navigationBar.bounds.size.height; int toolbarHeight = self.navigationController.toolbar.bounds.size.height; int statusBarHeight = [UIApplication sharedApplication].statusBarFrame.size.height; int cellHeight = collectionViewBounds.height - (navigationHeight + statusBarHeight + toolbarHeight); int cellWidth = collectionViewBounds.width; return CGSizeMake(cellWidth, cellHeight); }
To add to my confusion, pop works fine when the first or last item in a TableView peeks. Any help with this would be greatly appreciated.
source share