我現在有點絕望:/ 我有一個Tab Bar Controller with 4 Items。在4. Tab中,我包含了一個顯示pdf列表的webView。如果我在webView中打開PDF,則無法通過鏈接返回到主webView。有沒有辦法通過重新點擊4. TabBar重新加載視圖?如果我從3.更改爲4. tabbar它工作(viewWillAppear)。通過點擊TabBarItem重新加載ViewController
有人告訴我,下面的方法應該工作:
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController{
if ([viewController isKindOfClass:[UIColor class]]) {
//Try this if you're pushing the webView in another ViewController
[viewController.navigationController popToRootViewControllerAnimated:YES];
//or access to your webView and call goBack();
}
}
但實際上我不知道在哪個文件,我應該插入方法。 (見打印屏幕)
非常感謝您的幫助!
這是類似的問題。有一個關於如何重新加載頁面的教程,可以通過在選項卡上定位。 http://stackoverflow.com/questions/9709519/reload-uiview-when-pressing-tab-item-inside-initialized-view/9710060#9710060 – Canopus 2012-03-15 19:42:13
謝謝!我通讀了教程,但實際上我不知道在哪裏添加描述的代碼?如果您可以查看發佈的printScreen,您是否知道我必須添加所描述的實現? – joelschmid 2012-03-15 19:56:37