简体   繁体   English

缩小tableview的节标题,同时滚动tableview结束当前节,在顶部开始另一个节标题

[英]Shrink section header of tableview, while scroll the tableview end current section, start another section header at top

I'm developing an iphone app in which I have a UITableViewController in which the tableView contains two sections . 我正在开发一个iPhone应用程序,其中有一个UITableViewController ,其中tableView包含两个部分

The first section contains a single row of height 0 . 第一部分包含高度为0的单行。
The second section contains 100 rows each with a height of 44.0f . 第二部分包含100行,每个行的高度为44.0f

I am using section 0 as the title view for the tableView . 我将第0部分用作tableView的标题视图。
While the user scrolls up, section-0 header goes up and section-1 header becomes the title view for the tableView . 当用户向上滚动时,第0部分标题会上升,第1部分标题会成为tableView的标题视图。
Now, instead of the Section-0 header going up, i want it to shrink while the user scrolls up. 现在,我不想让Section-0标头上升,而是希望它在用户向上滚动时缩小。

Use the scrollViewDidScroll: or scrollViewWillBeginDragging: delegate method to track the contentOffset of the tableView . 使用scrollViewDidScroll:scrollViewWillBeginDragging:委托方法跟踪tableViewcontentOffset
Then, logically, set the height of the section header accordingly. 然后,在逻辑上相应地设置节标题的高度。
ie To give it a shrink effect, you can slowly reduce the height of the section header until it gets replaced by the next section header. 即,要使其具有收缩效果,可以缓慢减小节标题的高度,直到将其替换为下一个节标题为止。


Or see this: How to resize a tableHeaderView of a UITableView? 或看到此内容: 如何调整UITableView的tableHeaderView的大小?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM