I\'ve created a UICollectionView, so that I can arrange views into neat columns. I\'d like there to be a single column on devices > 500 pixels wide.
In order to achi
This is for others with maybe same special case.
Situation:
I included a UICollectionView
as a UITableViewCell
in a table view controller. The row height was set to UITableViewAutomaticDimension
to adapt on number of cells in the collection view. It didn't layout correctly on device rotation although other cells with dynamic content in the same table view behaved correctly. After a long research I found a solution that worked:
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator {
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
[self reloadTableViewSilently];
}
- (void) reloadTableViewSilently {
dispatch_async(dispatch_get_main_queue(), ^{
// optional: [UIView setAnimationsEnabled:false];
[self.tableView beginUpdates];
[self.tableView endUpdates];
// optional: [UIView setAnimationsEnabled:true];
});
}