4

Im not sure if this is the right place to post this kind of question, but, I heard from a colleage that he creates all his views in a table view and for each item creates a separate cell.

e.g. A title would be a different cell, image a different cell, etc.

Is this a normal practice or is this something that should be avoided?

The benefit of this method seems to be that you dont have to worry too much about layout and constraints, the problem in my opinion looks like that it becomes a lot harder to manage your code base.

1
  • Did this dev come-of-age during the table era of HTML programming, before css? That would explain it :P
    – Alexander
    CommentedApr 4, 2021 at 15:38

2 Answers 2

0

I don't get the point of doing such thing because UITableViews are used to display (large) sets of data and display those as rows. Maybe if you have an example, that would clarify your point.

On the other hand, you can use a UICollectionView to achieve what you say. UICollectionViews are quite flexible for displaying multidimensional data and achieve complex layouts. UICollectionViews are also good at managing large datasets.

1
  • If your layout is one-dimensional - and many layouts are - uitableview isn’t particularly bad. If it’s two dimensional then uicollectionview isn’t particularly bad to display lots of individual views. In both cases it’s kind of abusive, but it gets the job done.CommentedAug 3, 2021 at 21:38
0

It’s not particularly good, it’s not particularly bad either. If the features that a table view with n different cells provides you is good enough, why not?

UITableView is meant to handle thousand of row, but it will handle 5 rows just fine as well. You should probably know how to set cell heights etc.

It really doesn’t make it harder to manage your code base once you get used to it.

PS. Years later: Maybe you should have a look at UIStackView instead. You will need to use proper UIViews instead of UITableViewCells.

    Start asking to get answers

    Find the answer to your question by asking.

    Ask question

    Explore related questions

    See similar questions with these tags.