Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I know that the UICollectionView has been loaded completely?

I have to do some operation whenever UICollectionView has been loaded completely, i.e. at that time all the UICollectionView's datasource / layout methods should be called. How do I know that?? Is there any delegate method to know UICollectionView loaded status?

like image 669
Jirune Avatar asked Dec 24 '12 10:12

Jirune


People also ask

How is UICollectionView implemented?

Create a new iOS app projectAdd a CollectionView by pressing command shift L to open the storyboard widget window. Drag the collectionView onto the main view controller. Add constraints to the UICollectionView widget to ensure that the widget fills the screen on all devices.

How does UICollectionView work?

The collection view presents items onscreen using a cell, which is an instance of the UICollectionViewCell class that your data source configures and provides. In addition to its cells, a collection view can present data using other types of views.

What is the difference between Uitableview and UICollectionView?

Tableiw is a simple list, which displays single-dimensional rows of data. It's smooth because of cell reuse and other magic. 2. UICollectionView is the model for displaying multidimensional data .

What is UICollectionView flow layout?

Overview. A flow layout is a type of collection view layout. Items in the collection view flow from one row or column (depending on the scrolling direction) to the next, with each row containing as many cells as will fit. Cells can be the same sizes or different sizes.


1 Answers

This worked for me:

[self.collectionView reloadData]; [self.collectionView performBatchUpdates:^{}                               completion:^(BOOL finished) {                                   /// collection-view finished reload                               }]; 

Swift 4 syntax:

collectionView.reloadData() collectionView.performBatchUpdates(nil, completion: {     (result) in     // ready }) 
like image 81
myeyesareblind Avatar answered Sep 22 '22 17:09

myeyesareblind