I'm getting really strange error in my UITableView. I'm using standard views and sections.
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 44.0f;
}
- (NSString*) tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
switch (section)
{
case kSectionProfile:
return @"Profile";
break;
case kSectionContacts:
return @"Contacts";
break;
case kSectionApps:
return @"Apps";
break;
case kSectionSettings:
return @"Settings";
break;
case kSectionCount:
return nil;
break;
}
return nil;
}
TableView comes from XIB.
Simulator:
This is top of UITableView, section is never touching top of visible area and cells are drawn about section header. I have no idea what can be causing this strange problems. It seems that top of UITableView is not correctly calculated.
Update: Untick the following boxes in the storyboard/XIB on the VC object in the hierarchy.
From here: UITableView is starting with an offset in iOS 7
Old answer:
Use - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
delegate method and see if it helps.
Eg
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 20.0f;
}
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.