English 中文(简体)
UIWebView 代表第二次不工作
原标题:UIWebView delegate not working the second time

我有一个 RSS 种子, 返回包含标题、 简短文本和完整大小文本的json 。 他短文本的标题和部分显示在表格View 中 。

I have 3 controllers with 3 views. View 1 displays a TableView containing articles from the json( the title and short text ), each article has a "Read more" button, in the IBAction of the button, i push a viewcontroller(2) into the navigation controller, the controller has a UIWebView(second View), which loads a html string. The string contains links, when the user taps a link, i want to present a modal view controller with another WebView(3), this time using the request(keep in mind that both WebViews have separate controllers and nibs). The delegates are set properly on both of them, i tried both from code and using visual tools. In the delegate method shouldStartLoadWithRequest in the first WebView i check to see if the request parameter contains "http" or "www", because only then i want to call the second WebView. The second WebView works well the first time, the view is presented modally fine, but when i dismiss it and tap the same link or another, the shouldStartLoadWithRequest delegate method is not called, but the link loads in the same WebView(the first one).

我找到了这个,但是没有找到一个与我类似的案例,也没有找到一个解决方案。我对ios app 开发没有太多经验,但我对ios app 开发没有太多经验,但是一个同事是相当不错的,我们没能找到解决这个问题的办法。我们把代码分开分析,但是我们没有找到这个问题的潜在来源,他有一个“强势”的分离项目 ,他在那里有同样的问题,只有他使用一个控制器和一个WebView(我们的控制器和nibs,我们独立地创建了这个控制器和nibs ) 。我们在研究和代码检查方面非常彻底。

最佳回答

解决方案似乎相当容易。 首个WebView, 明显地松开连接到它的代表, 所以在第二个WebView 控制器中, 添加

- (void)viewWillDisappear:(BOOL)animated {
    [self.parentViewController viewWillAppear:YES];
}

在第一个 WebView 的第一个控制器中:

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

    webView_.delegate = self;
}

我希望这能帮到某人

问题回答

暂无回答




相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签