当调起UIImagePickerController拍照时,在 debug view Hierarchy
中 可看到navigationBar整体上移了20,需要在合适的时机做一次恢复原位处理。
解决思路:
- UIImagePickerController分类中,对disappear方法交换
- 获取上一个VC(即H5 wkwebview的VC)所在的nav
- 在disappear时
nav.navigationBar.top = kStatusBarHeight
;
-(void)sx_viewWillDisappear:(BOOL)animated{
sx_disableFixSpace = NO;
[self sx_viewWillDisappear:animated];
UINavigationController *topNav = [self getTopNavigationController];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
//让状态栏显示
[topNav setNeedsStatusBarAppearanceUpdate];
//topNav.navigationBar.top = kStatusBarHeight;
if ([topNav.viewControllers.lastObject isKindOfClass:[UITabBarController class]]) {
UITabBarController *tabbarC = topNav.viewControllers.lastObject;
UINavigationController * nav = tabbarC.selectedViewController;
nav.navigationBar.top = kStatusBarHeight;
}
});
}
fixed: H5调系统拍照 导航栏上移20 【待研究更佳方式】
网友评论