Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create UICollectionView without using the storyboard?

I have found some nice tutorials of UIcollectionview over the net

http://www.raywenderlich.com/22324/beginning-uicollectionview-in-ios-6-part-12

http://ashfurrow.com/blog/uicollectionview-example

Is it possible to use the collectionview without the storyboard?

What are the pros and cons of using the storyboard with collectionview?

like image 916
Veera Raj Avatar asked Jan 25 '13 21:01

Veera Raj


2 Answers

Yes. It can be done either way. please refer to following examples.

UPDATE: This(1st) example is more suitable for the question.. http://adoptioncurve.net/archives/2012/09/a-simple-uicollectionview-tutorial/

http://blogs.captechconsulting.com/blog/paul-dakessian/ios-6-tutorial-getting-started-collection-views

http://invasivecode.tumblr.com/post/34581461219/an-introduction-to-collection-views.

I am not very sure but there shouldn't be any pros and cons for using storyboards apart from its easy to implement.

like image 180
Obj-Swift Avatar answered Sep 28 '22 19:09

Obj-Swift


In fact it is very easy with the story board. From the tutorials above you can see how to setup the story board. Once you do that you need to go again to the story board, select the cell in the collection view and then in the right sight bar in the identity inspector (the 3rd inspector) type in your sub class of view cell. Afterwards go to the attributes inspector (the 4th inspector). There right on the top is a field "Collection Reusable View" - Identifier. Type in your reusable identifier string, the same one that you will give to dequeueReusableCellWithReuseIdentifier.

That's all. Once you do it, you will see that it is super simple.

like image 41
Stefan Avatar answered Sep 28 '22 18:09

Stefan