开发者

Custom Section Title View for UITableView

开发者 https://www.devze.com 2023-03-08 21:00 出处:网络
In some apps such as Cool Iris, LiveShare, i see them using custom views for their plain U开发者_如何学CITableView section titles.Is there a way to replace the standard section title bar with a custom

In some apps such as Cool Iris, LiveShare, i see them using custom views for their plain U开发者_如何学CITableView section titles. Is there a way to replace the standard section title bar with a custom view?


In order to customize the look of your section header, there are two methods you will probably want to use.

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section

and

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section

These are both found in the UITableView delegate protocol. The first will let you create a custom view to display as your section header. The second just makes sure you get the size you want for it so that your view doesn't get cut off

0

精彩评论

暂无评论...
验证码 换一张
取 消