简体   繁体   中英

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 .

The first section contains a single row of height 0 .
The second section contains 100 rows each with a height of 44.0f .

I am using section 0 as the title view for the tableView .
While the user scrolls up, section-0 header goes up and section-1 header becomes the title view for the tableView .
Now, instead of the Section-0 header going up, i want it to shrink while the user scrolls up.

Use the scrollViewDidScroll: or scrollViewWillBeginDragging: delegate method to track the contentOffset of the tableView .
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?

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.

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