How do I adjust the left margin for prototype cells in a UITableView?

后端 未结 10 1411
天涯浪人
天涯浪人 2020-12-02 14:27

If I create a UITableViewController, for example via File → New Project... → iOS → Master-Detail Application in Xcode, a UITableView

10条回答
  •  失恋的感觉
    2020-12-02 14:48

    I think I just came up with an easy solution. lol.

    The top answer have some problem...it decrease the left gap, but resulting a right gap.

    I used the constrains in Interface Builder.

    First add a -15 left margin constrain to the Table View.

    Then add some Indentation to the Table Cell to make the contents look better.


    Here're some step-by-step pics:

    Add the constraint. Remember to uncheck the "spacing to nearest neighbor".

    Add the constraint. Remember to uncheck the

    The Table Cells will move left. But seems too close to margin.

    After adding the constraint

    So choose the Table Cell, and add some indentation in the right area.

    add some indentation

提交回复
热议问题