UITableViewCell: rounded corners and shadow

前端 未结 14 1394
故里飘歌
故里飘歌 2020-12-02 05:05

I\'m changing the width of a UITableViewCell so that the cell is smaller but the user can still scroll along the edges of the tableview.

override func layout         


        
14条回答
  •  生来不讨喜
    2020-12-02 05:13

    Never use UIBezierPath , bezierPathWithRect:shadowFrame etc as its really heavy and draws a layer on top of the views and would require to reload the table view again to make sure the cells are rendering in the right way and sometimes even reloading might not help. Instead use a section header and footer which has rounded edges as required and also which is inside the storyboard which will make the scrolling and loading of table view very smooth without any rendering issues ( sometimes called missing cells and appears on scroll )

    refer here how to set the different integer values for rounded corners here : Setting masked corners in Interface Builder

    Just use the above values for your section header and footer.

提交回复
热议问题