【问题标题】:UIWebView loadingUIWebView 加载
【发布时间】:2011-08-03 15:47:35
【问题描述】:

我想在 webview 中加载 html 数据。单击按钮时,它会打开视图控制器并在此视图控制器中加载 html 数据(使用界面生成器在此视图控制器中添加 Web 视图)。当 html 数据未正确加载并且我按下后退按钮时,当时应用程序崩溃。我没有在编码中进行分配和初始化 webview。使用 Interface builder 设置 IBOUTLET 并绑定它。

- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
    [connection release];
    NSString *strResponce = [[NSString alloc] initWithData:jsonData_Info encoding:NSUTF8StringEncoding];
    [jsonData_Info release];
    NSError *error;
    SBJSON *json = [[SBJSON new] autorelease];
    self.jsonArray_Info=[json objectWithString:strResponce error:&error];
    str_InfoDetail = [[self.jsonArray_Info objectAtIndex:0] valueForKey:@"Page"];
    str_html = [NSString stringWithFormat:@"%@",str_InfoDetail];
    NSString *temp;
    temp = [NSString stringWithFormat:@"<html><head><style>body{background-color:transparent;}</style></head><body><span style='color:white'>%@</span></body></html>",str_html];
    //web_Information = [[UIWebView alloc]init];
    web_Information.backgroundColor=[UIColor clearColor];
    web_Information.opaque= NO;

    [web_Information loadHTMLString:temp baseURL:nil];  
    [act stopAnimating];
    [strResponce release];  
}

请给我任何解决方案。

谢谢。

【问题讨论】:

    标签: iphone objective-c uiwebview


    【解决方案1】:

    如果您需要答案,请发布一些代码和崩溃日志。从外观上看,我认为这可能是因为在您的班级中实施了 UIWebView 委托。我认为当您向后导航时,您不会将委托设为 nil,这可能会导致应用崩溃

    【讨论】:

      猜你喜欢
      • 2014-02-28
      • 2023-03-03
      • 2012-05-24
      • 2013-11-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多