2011-04-12 125 views
2

我想在webview中加载html数据。点击按钮后,它会打开视图控制器并在此视图控制器中加载html数据(使用界面构建器在此视图控制器中添加网络视图)。当HTML数据不正确的加载,我按下后退按钮,在那个时候崩溃的应用程序。我没有在编码中做分配& init webview。使用接口生成器&设置IBOUTLET将其绑定。UIWebView加载

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

请给我任何解决方案。

谢谢。

+0

把一些代码.. – 2011-04-12 07:25:38

回答

0

请张贴一些代码和崩溃日志,如果你需要的答案。从它的外观来看,我认为这可能是因为你班上实施了代表UIWebView。我认为,当你导航回你不会使委托零这可以导致应用程序崩溃