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];
}