2009-09-08 19 views

Respuesta

5

Desde IOS5 UIWebView tiene scrollView propiedad. Puede utilizar variable de tipo CGPoint se define así:

CGPoint _scrollPosition; 

Entonces inicializarlo:

_scrollPosition = CGPointMake(0, 0); 

Dondequiera que necesita para almacenar el uso posición actual:

_scrollPosition = _webView.scrollView.contentOffset; 

Implementar UIWebViewDelegate protocolo y agregar código para restaurar la posición dentro de -(void)webViewDidFinishLoad:(UIWebView *)webView:

- (void)webViewDidFinishLoad:(UIWebView *)webView 
{ 
    // .... your other code here ... 

    if (0 < _scrollPosition.y) { 
     _webView.scrollView.contentOffset = _scrollPosition; 
     _scrollPosition = CGPointMake(0, 0); 
    } 
} 
Cuestiones relacionadas