I have a HTML list of about 500 items and a "filter" box above it. I started by using jQuery to filter the list when I typed a letter (timing code added later): $('#filter').keyup( function() { var jqStart = (new Date).getTime(); var search = $(this).val().toLowerCase(); var $list = $('ul.ablist > li'); $list.each( function() { if ( $(this).text().toLowerCase().indexOf(search) === -1 ) $(this).hide(); else $(this).show(); } ); console.log('Time: ' + ((new Date).getTime() - jqStart)); } ); However, there was a couple of seconds delay after typing each letter (particularly the first letter). So I thought it may be slightly quicker if I used plain Javascript (I read recently that jQuery's each function is particularly slow). Here's my JS equivalent: document.getElementById('filter').addEventListener( 'keyup', function () { var jsStart = (new Date).getTime()...
From checking the defaults in my app it looks like for a grouped table the default is a height of 10 and for a non-grouped table the default is a height of 22.
ReplyDeleteIf you check the value of the property sectionHeaderHeight on your tableview that should tell you.
Actually do the trick :)
ReplyDelete- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
if(section == 0)
return kFirstSectionHeaderHeight;
return [self sectionHeaderHeight];
}
I'm not sure what the correct answer is here, but neither 10 or 22 appears to be the correct height for a grouped table view in iOS 5. I'm using 44, based on this question, and it at least appears to roughly the correct height.
ReplyDeleteThis should do the trick
ReplyDelete- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if(indexPath.section == CUSTOM_SECTION)
{
return CUSTOM_VALUE;
}
return [tableView rowHeight];
}