通過[self.navigationController pushViewController:viewController animated:YES]; 這種方法跳到環(huán)信聊天界面時,則一切正常耿币。
但是如果通過[self presentViewController:chatVc animated:YES completion:nil];這種方法跳到環(huán)信聊天界面時贷掖,點擊聊天圖片會無效,控制臺提示:
2017-01-06 23:40:20.711 GreenPZ[1788:689882] Warning: Attempt to present <UINavigationController: 0x164a7c00> on <GTabbarViewController: 0x16331200> whose view is not in the window hierarchy!
解決方法:
在 EaseUI的 EaseMessageReadManager.m的-(void)showBrowserWithImages::(NSArray *)imageArray方法里
最后兩句話
UIViewController *rootController = [self.keyWindow rootViewController];
[rootController presentViewController:self.photoNavigationController animated:YES completion:nil];
由于在設(shè)置根視圖時, 將自定義的GTabbarViewController作為了rootViewController,所以系統(tǒng)找不到根視圖了
修改為:
UIViewController *vc = [[UIViewController alloc] init];
vc.view.hidden = YES; // 在回來之后上面會覆蓋一層view所以要設(shè)為hidden, 否則界面無法操作
[self.keyWindow addSubview:vc.view];
[vc presentViewController:self.photoNavigationController animated:YES completion:nil];
問題解決葛圃。