Reputation: 71
I have created a table view with static cells and it looks good in the main storyboard but when I run the application the contents of the table view is empty. I think this is because the numberOfSections and numberOfRowsInSections functions are resetting the table view to 0. When I remove these functions the table view appears as desired.
My questions is am I okay to leave these functions out and are there any other functions I should include to conform to good coding standards?
Upvotes: 0
Views: 37
Reputation: 1392
If you use static cells, you can remove both methods or change values to return the correct number of sections and methods.
You can also define all the content of cells in the storyboard or override the method :
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
It depends on what you are looking for.
Upvotes: 1