简体   繁体   中英

Using the same cell in all collection views

Probably a stupid question, but I could not find the answer to it yet.

How can I declare ONE template for collection view cell and then use it in ALL collection views? I'm using storyboard.

Because now I have 3 collection views that are the same (on 3 tab pages), which differ only in the data (all collection views use one datasource with different params). If I have to change some style, I have to do this 3 times...

Even better, if I can create some "user control" that inherits the collection view and use it everywhere I need (like fragments in Android or partial controls in asp.net mvc). Is it possible with storyboard? What is the right approach in my case?

Thank you very much!

This is done the same way as a UITableViewCell

TTCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath;

Ray has some good tuts on the subject UICollectionView

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM