iOS - Swift - Spacing between cells -
i'm trying add spacing between cells in uitableview. solutions read on here follows:
- add empty cell between each real cell (%2 condition)
- use sections instead of rows
- put cell's content in container uiview , make cell's height bigger container view.
- adding padding using separatorinset property via code doesn't work because apple stated left , right separatorinset taken consideration.
as can see, solutions pretty hacking solution, each has own disadvantage.
what's real way adding spacing? can't believe such simple thing can hard achieve.
what's real way adding spacing?
there no "real way" of adding spacing between cells of table view. table view's cells always adjacent 1 another; can provide illusion not, "solutions" do. can think of other, less "hacking" approaches — draw each cell's contents partially, leaving space between drawing inside 1 cell , drawing inside next — it's still illusion.
if want true flexibility position cells actual distance 1 another, use collection view instead; that's it's for. generalizes table view layout of cells in hands.
Comments
Post a Comment