White space before separator line into my TableView

后端 未结 8 1948
青春惊慌失措
青春惊慌失措 2020-11-30 19:49

I have a question about UITableView... I have a UITableViewController and I created a custom cell. When I visualize the tableView I see a little white space before the separ

相关标签:
8条回答
  • 2020-11-30 20:43

    Alternatively, you can also edit this in interface builder (IB):

    1. Go to IB.
    2. Select Table View.
    3. Open "Attribute Inspector" on the right.
    4. Change "Separator Insets" from Default to Custom.
    5. Change the "Left" attribute from 15 to 0.

    This has the same effect as @Ashok's answer, but doesn't require writing any code.

    Update Works on iOS 7 and 8

    Update Works on iOS 9

    0 讨论(0)
  • 2020-11-30 20:47

    For those of you who want to make the retain the UIEdgeInsetSettings in Swift and are not using Storyboards:

    Before: (Default Behavior)

    Before, Default Setting

    Add the following code:

    tableView.separatorInset.right = tableView.separatorInset.left
    

    After, Implemented

    0 讨论(0)
提交回复
热议问题