문제

I have UIWebView and have x & y coordinates. When i go to viewcontroller i need to go that particular coordinate inside UIWebView. But it loads the view from zero position. It's like a bookmark on page. When i bookmark i'm getting coordinates value and selected text. Later, if selected text coming i need to go that point.

-(void)viewDidLoad{

 wbCont = [[UIWebView alloc] initWithFrame:CGRectMake(0, 45, 320, 568)];

  [wbCont loadHTMLString:webString baseURL:nil];
[self.view addSubview:wbCont];

[self.view addSu

NSUserDefaults *xv=[NSUserDefaults standardUserDefaults];

    float bx=[xv floatForKey:@"xvalue"];


    NSUserDefaults *yv=[NSUserDefaults standardUserDefaults];

    float by=[yv floatForKey:@"yvalue"];



    NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
    // getting an NSString
    NSString  *savedValue = [prefs stringForKey:@"got"];



    if(savedValue){


             CGPoint pt = CGPointMake(bx, by);


          NSLog(@"CGPoint Value – %@", NSStringFromCGPoint(pt));



        }


    }
도움이 되었습니까?

해결책

Try

- (void)webViewDidFinishLoad:(UIWebView *)webView
{
  [webView.scrollView setContentOffset:CGPointMake(100, 100) animated:YES];
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top