ios - How to stop a UIScrollView from scrolling when it reaches the bottom -
i have following code in place grab event when uiscrollview reaches end of content view:
- (void) scrollviewdidenddecelerating:(uiscrollview *) scrollview { float currentendpoint = scrollview.contentoffset.y + scrollview.frame.size.height; // cgpoint bottomoffset = cgpointmake(0, scrollview.contentsize.height - scrollview.bounds.size.height); // [scrollview setcontentoffset:bottomoffset animated:no]; if (currentendpoint >= scrollview.contentsize.height) { // @ bottom
i notice when scroll bottom hits , bounces up.
if add this:
cgpoint bottomoffset = cgpointmake(0, scrollview.contentsize.height - scrollview.bounds.size.height); [scrollview setcontentoffset:bottomoffset animated:no];
then scroll goes bottom.
is there way stay @ bottom without "bounce up" in once hits bottom, stop moving.
thanks.
you should uncheck bounce property of scrollview. check screenshot!
Comments
Post a Comment