in iOS 7 viewForHeaderInSection section is starting from 1 not from 0

前端 未结 2 978
名媛妹妹
名媛妹妹 2021-01-30 16:52

I am dealing with UITableView in my project and this project is created in Xcode 4.5 and now I am working with Xcode 5, so my question is when I will run my project

2条回答
  •  梦如初夏
    2021-01-30 17:07

    Just encountered exactly the same issue, and the resolution turns out very simple.

    Just implement this delegate method:

    - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
    {
        return 20;
    }
    

    Form Apple UITableViewDelegate Protocol Reference, it mentioned

    Discussion

    The returned object can be a UILabel or UIImageView object, as well as a custom view. This method only works correctly when tableView:heightForHeaderInSection: is also implemented.

提交回复
热议问题