Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Collectionview Controller vs Collectionview

Tags:

ios

I'm beginner at IOS. I don't quite understand what is difference between collection view and collecionviewcontroller and in what cases can I use each of them

like image 591
TamKap Avatar asked Apr 21 '15 13:04

TamKap


People also ask

What is collection view controller?

When the collection view is about to appear for the first time, the collection view controller reloads the collection view data. It also clears the current selection every time the view is displayed. You can change this behavior by setting the value of the clearsSelectionOnViewWillAppear property to false .

What do you mean by a value Uicollectionview?

The collection view maintains a queue or list of view objects that the data source has marked for reuse. Instead of creating new views explicitly in your code, you always dequeue views. There are two methods for dequeueing views.


2 Answers

UICollectionView inherits from UIScrollView (just another UIView)

UICollectionViewController inherits from UIViewController.. and it implements some protocols.. like UICollectionViewDelegate and UICollectionViewDataSource .. it means everything is already done for you.. and you just have to use it.. but as everything is already done for you.. you may not be able to do some stuff.. like resizing your collectionView ..

if you want full control I recommend you to use your own UIViewController.. and add a UICollectionView as a subview.. so you can place it wherever you want and resize it.. don't forget to implement UICollectionView protocols for delegation and datasource :)

like image 51
Marcio Romero Patrnogic Avatar answered Oct 06 '22 13:10

Marcio Romero Patrnogic


It's based on your requirements. You may change some properties with your View controllers. But when you use as part of its' controllers, you can't change it.

For example you Can´t change UICollectionView Size of UICollectionViewController.

In these case, you must use UICollectionView in viewcontroller. As like this, if you want to customize some property but functionality are same in all.

Here I mention some ref for you: refrence

like image 34
bLacK hoLE Avatar answered Oct 06 '22 13:10

bLacK hoLE