ios - Prevent UIWebView From Scrolling Too Far -


i have 2 buttons, scroll , scroll down used scroll webpage in uiwebview. issue is, once hit top or bottom of page can keep scrolling. can scroll until entire webpage off of uiwebview. know code need plug in prevent happening? i've been researching while , going on head. possible detect webpage has ended? code i'm using scroll, have feeling need throw if statement in here check if has hit top of webpage.

    //scroll up: -(ibaction)scrollcontentup:(id)sender {      [_viewweb.scrollview setcontentoffset:cgpointmake(0,_viewweb.scrollview.contentoffset.y - 40.0) animated:yes];  }  //scroll down: -(ibaction)scrollcontentdown:(id)sender {     [_viewweb.scrollview setcontentoffset:cgpointmake(0,_viewweb.scrollview.contentoffset.y + 40.0) animated:yes];  } 

by way, it's ipad app.

+you need like:

   //scroll up: -(ibaction)scrollcontentup:(id)sender {     if(_webview.scrollview.contentoffset.y - 40 >= 0) {         [_viewweb.scrollview setcontentoffset:cgpointmake(0,                                     _viewweb.scrollview.contentoffset.y - 40.0)                                       animated:yes];     } }  //scroll down: -(ibaction)scrollcontentdown:(id)sender {     if(_webview.scrollview.contentoffset.y + _webview.frame.size.height + 40 <= _viewweb.scrollview.contentsize.height ) {             [_viewweb.scrollview setcontentoffset:cgpointmake(0,                                         _viewweb.scrollview.contentoffset.y + 40.0)                                           animated:yes];     }  } 

Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Socket.connect doesn't throw exception in Android -

SPSS keyboard combination alters encoding -