开发者

Is there a way to make the very LAST section header scrollable to the top?

Basically I have complete default behaviour going on with the section headers. I just wish that the user could scroll the LAST section header to the very top.

E.g You have a table where rows with 44 pixel height. Table has a height of ~500 pixels. If the LAST section only has 2 entries, you will not be able to scroll this section to the very top of the table, thereby leaving the previous section header at the top and the last section header somehwere in the middle of the screen, revealing the last 2 rows of the last section.

I'd like it so the user can scroll the last section header to the top - leaving empty rows (if necessary) fo开发者_Python百科r the bottom half of the table if the last section contains only a few rows.

Is this at all possible?


Yes it is.........

what you have to do is just set the contentInset for the table view....

[yourTableView setContentInset:UIUIEdgeInsetsMake(0,0,yourScrollableHeight,0)];

**Update*** Here is the procedure to know the cell in last section ...(cellForRowAtIndexPath code)

int numberOfSections = [yourTableView numberOfSections];
if(it's last section... [indexPath.section == numberOfSections-1])
{
  int numberOfRowsInLastSection = [yourTableView numberOfRowsInSection:indexPath.section];
  //default height of row is .. 44px...
  // now I hope you can calculate this......
  //and here use above line of code for setting scroll behavior...
}

thanks,

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜