ios - Hiding a toolbar element when UITableView scrolls (similar to Facebook's app?) -
how can achieve effect?
full top view http://i39.tinypic.com/f0vx4l.png half top view http://i40.tinypic.com/2w7486r.png top view hidden http://i42.tinypic.com/k95r9.png
this isn't noticeable screenshots, believe want header toolbar slide user scrolls, right? (i'd suggest clarifying on part)
you can few ways, , in of them have implement own scrolling logic, meaning how header toolbar slides depending on have scrolled. said, here's how it:
1. if you're using uitableview
, assume you've got view controller set delegate
. since uitableview
subclass of uiscrollview
already, add uiscrollviewdelegate
view controller. give scroll events happen. you'll want logic in scrollviewdidscroll:
.
2.. if you're using uiscrollview
, set view controller delegate, implement uiscrollviewdelegate
, , logic in scrollviewdidscroll:
.
that said, code might this:
- (void) scrollviewdidscroll:(uiscrollview *)scrollview { cgpoint scrollpos = scrollview.contentoffset; if(scrollpos.y >= 40 /* or cgrectgetheight(yourtoolbar.frame) */){ // hide toolbar } else { // slide incrementally, etc. } }
anyway, hope helped.
Comments
Post a Comment