Matching left alignment of custom & standard UITableViewCell types

前端 未结 5 2222
清歌不尽
清歌不尽 2020-12-23 17:11

I\'m defining custom UITableViewCells in a storyboard. I\'m also using some of the built in standard style cells. I need to set up constraints so that my

5条回答
  •  感动是毒
    2020-12-23 17:40

    In iOS8 Apple introduced layoutMargins

    You can set it in your storyboard or on your code simply like this :

    cell.layoutMargins = UIEdgeInsetsZero // change by your custom value
    

    Before that, you must set preservesSuperviewLayoutMargins to NO to prevent the cell from inheriting the Table View's margin settings

    preservesSuperviewLayoutMargins : A Boolean value indicating whether the current view also respects the margins of its superview.

    Hope this can help you ;)

提交回复
热议问题