8

I've got an universal iOS app that I originally made using UITableViews, but it's time to update it with UICollectionViews so that I can take better advantage of the display on iPad.

There is a LOT of functionality that comes along with UITableView and I feel like I'm losing a ton in exchange for the flexibility of grid layouts and such.

For example, the separator line between cells is something I have to implement myself. Not too much problem.

Or Header views, I know how to add them, but it appears that I have to hand-code the settings to try to mimic the style and color themes of the UITableView instead of just having a default that matches. Sure, I can try to mimic it, but as soon as iOS 10 comes out and they change the look of the header views, then suddenly my app doesn't match anymore and looks dated.

But disclosure indicators are an even bigger problem. Is there any way to get a disclosure indicator on my UICollectionViewCell in a built-in fashion? Yes, I know that I can try to find a graphic that looks similar to the disclosure indicator and add it to my custom cell, but for something that is baked in to the UITableViewCells, I'm not particularly loving the idea of having to custom add all of this functionality to every single cell type I made for UICollectionViews. Especially when iOS 10 drops and all of my disclosure indicators are out of date again.

Not to mention that I'm also losing the built-in segue functionality for disclosure indicators.

Am I missing something? Is there some way to tap in to take advantage of really nice defaults in a UICollectionView so that it will look like a UITableView?

Kenny Wyland
  • 20,844
  • 26
  • 117
  • 229

1 Answers1

0

UICollectionViewCell and UITableViewCell are very similar. They share similar method names, similar behaviors, but they are designed for different purposes. While UICollectionViewCell should be used in contexts with a very variable layout (e.g. adaptive cells, waterfall layouts, etc.), UITableViewCells are more static and mainly used to list object.

To get some of the UITableViewCell behaviors into UICollectionViewCell you should recreate them by yourself or using an external library. Just an example: UICollectionViewCell doesn't have the swipe-to-delete gesture, so you have to make it by yourself or using a lib. In this case, the disclosure indicator can be replaced with custom images and buttons. You can take them from a iOS 9 Photoshop file like this.

Reference: Setting Up a UICollectionView in iOS

Community
  • 1
  • 1
Nicola Giancecchi
  • 3,045
  • 2
  • 25
  • 41
  • 1
    I'm asking if there is a way built-in to make them look the same, because otherwise I'm immediately out of date. As I said in my question: "Sure, I can try to mimic it, but as soon as iOS 10 comes out and they change the look of the header views, then suddenly my app doesn't match anymore and looks dated." – Kenny Wyland Mar 06 '16 at 20:25
  • Ok, but if there isn't any native way to implement the UITableViewCell look and feel, how can you have the same behavior if you don't mime it? – Nicola Giancecchi Mar 07 '16 at 08:14
  • `but if there isn't any native way to implement the UITableViewCell look and feel` That's my question. IS THERE a native way for UICollectionViewCells to adopt a standard UITableViewCell's look and feel? – Kenny Wyland Mar 08 '16 at 01:12
  • Doesn't answer the question. – mxcl Dec 03 '16 at 19:43