ios - How can I detect when a UITableView has been scroll past the very bottom/top? -


i've got view has 3 tableview's. 1 "main table view", , have 'answers table view' , 'percentage table view'.

when screens loads, main table view occupies top 95% of screen. bottom of screen uiview containing 2 buttons. "answers" , "percentage".

the way works, if click "percentage" changes height of main table view 0, , gives height answers table view. animates "answers/percentage" view top, , reveals either answers or percentage tableview below it.

here's example:

enter image description here

as can see, click on "percentage" animates up. if click on "percentage" again animates down.

however, want if "answers/percentage" view @ bottom of view, , user scrolls main feed reaches end of tableview's contents (not end, end , little bit more), want animate in .gif.

similarly, if "answers/percentage" @ top, , user scrolls lower "answers table view" down past point there no more data above, animate.

also, not ever want "answers/percentage" view in middle, , showing tableview both top , bottom. one, or other, not bit of both. have right now.

what need know is... how can detect if user has scrolled past top or bottom of table view +30 pixels example, initiate animation?

you can use contentoffset property of table view.

if(tableview.contentoffset.y >= (tableview.contentsize.height - tableview.frame.size.height)) {     // start animation } 

i haven't tested this, let me know if works.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -