2011-04-12 61 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。我認爲,當你導航回你不會使委託零這可以導致應用程序崩潰