Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 in iOS 6 , the viewForHeaderInSection method section is starting from 0 it's ok but If I will use iOS 7 to run viewForHeaderInSection section is starting from 1 not from 0

What is the problem is there any UITableView frame's problem or not

I can't understand what is going on

Thanks in Advance

like image 653
Bhavesh Lathigara Avatar asked Sep 21 '13 12:09

Bhavesh Lathigara


1 Answers

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.

like image 96
Evan Chu Avatar answered Oct 09 '22 13:10

Evan Chu