-2

我有 UIWebView 并且有 x & y 坐标。当我进入 viewcontroller 时,我需要进入 UIWebView 中的特定坐标。但它从零位置加载视图。它就像页面上的书签。当我添加书签时,我得到坐标值和选定的文本。稍后,如果选定的文本来了,我需要去那一点。

-(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));



        }


    }
4

1 回答 1

0

尝试

- (void)webViewDidFinishLoad:(UIWebView *)webView
{
  [webView.scrollView setContentOffset:CGPointMake(100, 100) animated:YES];
}
于 2013-11-14T13:23:16.323 回答