Two problems when iOS tableView customizes the header

    tableView custom header, implemented in the following methods, according to the style of tableView, if the style is group, the header will not hover, when it is plain, the header will hover;

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

   When it is a group, if the header is set, then the footer will have a default height, and you will see that the first header is normal, but when the second Section, there is a part of the content. As shown below:

    

    

    At this time, you need to also set the table tail. In the following method, set the height to 0.01, and cannot be set to 0, and 0 does not work.

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section;

     So when you need to set the header and the style is plain, the header will hover and display normally. If the style is group, the header will not be hovered, but the footer needs to be removed to display normally



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324520950&siteId=291194637