Hacker News new | past | comments | ask | show | jobs | submit login

That's a pretty interesting approach. Wouldn't it be cleaner to use a UICollectionView with a custom layout?



Most definitely! UICollectionViewLayout should be the right answer, but the thing is: the Slack iOS app was already built using UITableView, drawing many many custom cells. We'll probably port someday to UICollectionView ;)


We do the same thing, custom views, mostly drawn in -drawRect:, reused in different cells. It's actually a very nice technique but like you said, the are some sacrifices to take. Still, these cells depend of a tableViewcCell which has unique properties and special APIs that collectionViewCells don't. I think the most trikcy part here is to be able to build a custom UICollectionViewLayout allowing to display cells from the bottom. Haven't found any third-party doing it well enough yet. Do you know of any?


I've started experimenting not making cells but UIViews and just add them on top of cells. I haven't gone with that fully yet but I've planned to try it out.

The downside is you lose out on many of the out of the box stuff, like cell background highlights that you know have to define yourself.

The upside is that you can now reuse the UIView everywhere, including non-subclasses of ScrollView.


You should add your view to the cell's contentView instead of directly on the cell, which allows you to keep the default behaviors and also reuse the view.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: