我知道,這個問題已經問了很多次,但沒有幫助過我。所以我想在觸摸UITableView中的一行時觸發loadRequest。但由於某種原因,它不起作用。當[webView loadRequest:request];被稱爲,沒有任何反應。這裏是我的代碼:此代碼的UIWebView不調用loadRequest如果從tableView調用:didSelectRowAtIndexPath:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *bookmarkString = [NSString stringWithFormat:@"%@", [bookmarks objectAtIndex:indexPath.row]];
NSURL *url = [NSURL URLWithString:bookmarkString];
NSURLRequest *request1 = [NSURLRequest requestWithURL:url];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
[self dismissModalViewControllerAnimated:YES];
[myWebView1 loadRequest:request1];
urlField1.text = bookmarkString;
}
我已經嘗試了許多不同的變化,但沒有任何工程。使用斷點調試後,所有內容都會被調用,但Web視圖上沒有任何事情發生。解除模態視圖控制器的工作,但不是loadRequest。誰能幫忙?
編輯:我用故事板
你確定'myWebView1'不是零?例如,您可能已經忘記在IB中連接一個插座。 – DPlusV 2012-07-22 08:32:13
一切工作,如果我從別的地方做的加載請求,如從UITextField。 – imas145 2012-07-22 09:21:18