my goal create tableview paging enabled uses sections determine amount of pages, , page you're on.
example: 3 sections 1 section: 3 cells 2nd section: 14 cells - scrolls bottom of section normal tableview would, when hits bottom, if user continues swiping, goes next page. 3rd section: 8 cells - scrolls bottom , stops.
so first page have 3 cells, blank space, if started scroll next section appear, section header snap top , have changed pages
the second page has many cells more can fit on single screen @ 1 time, user scrolls bottom of these, once bottom reached, can continue scroll reveal third section header, header snap top, etc
i know how create pages tableview, paging out tableview using sections rather view height not know possible
i had similar design.
i needed first section take entre screen , second 1 infinite scroll, paging between section 1 , section 2 when scrolling down. also, when scrolling up, wanted scroll stop before top section.
i know different case, quite figure out height of each section , apply design.
here how did :
func scrollviewdidscroll(scrollview: uiscrollview) { let offsety = scrollview.contentoffset.y if (lastcontentoffset > offsety) { tablenode.view.pagingenabled = offsety < view.frame.height } lastcontentoffset = offsety } func scrollviewdidenddecelerating(scrollview: uiscrollview) { let offsety = scrollview.contentoffset.y tablenode.view.pagingenabled = offsety < view.frame.height }
note scrollviewdidenddecelerating
important re-enable paging when scrolling down.
also notice setting tablenode.view.pagingenabled
when user scrolls in scrollviewdidscroll
function.
hope helps looking in future, hope @yichenbman have come solution now.