简体   繁体   中英

UITableView with a plain listing but make the section header be like a grouped listing

I am using a UITableViewController with a plain style. I like how the cells expand to the edges of thew view, but I hate how the section titles stick to the top.

Is there a way to have section titles behave similar to how a grouped listing works?

What about using grouped style but removing the left and right margins. Possible?

I think this question might answer you. One awkward way of achieving this is not using the UITableView sections and draw cells instead with your a custom design.

You could always create a custom cell with the appearance of a section header. That's what I've done in the past to for these kinds of scenarios, that way it won't stick to the top of the view. This of course requires additional logic such as disabling section headers and and using your new custom section header as a single celled section in your table view, if you catch my drift. It's actually not that hard and gives you good flexibility.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM