Grouped UITableView and horizontal margins

六眼飞鱼酱① 提交于 2019-12-06 02:30:50
Clafou

Good news! I finally found a way to achieve this satisfactorily with only tiny code changes:

You can always keep the standard table view and provide custom backgrounds with transparent sides for the table view cell's so that they look smaller than they are.

Cocoa With Love has a great article on how to do that here: Easy custom UITableView drawing.

The basic gist of the article is that you need to make six different versions of the backgrounds, and supply the correct one when tableView:cellForRowAtIndexPath: asks for a cell. You will need one with rounded corners at the top (for the first row of a section), one with rounded corners at the bottom (for the bottom row of a section), and one with all four corners rounded (for when there is only one row in the section). Then you will need the same three, but customized for the "selected" version of each row.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!