iOS 侧滑返回侧滑返回,有的页面隐藏导航条,动画过程中导航头补

2018-03-14  本文已影响166人  爱闹的凡

3、侧滑返回,有的页面隐藏导航条,动画过程中导航头缺失,通过截图补充

-(UIViewController *)popViewControllerAnimated:(BOOL)animated
{
    if (![self.currentShowVC.view viewWithTag:888888]) {
        UIGraphicsBeginImageContextWithOptions(self.navigationBar.bounds.size, YES, 0.0);
        
        [self.navigationBar.layer renderInContext:UIGraphicsGetCurrentContext()];
        
        UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
        
        UIGraphicsEndImageContext();
        UIImageView *headBackIV = [[UIImageView alloc] initWithFrame:CGRectMake(0, -64, SCREEN_WIDTH, 64)];
        headBackIV.image = [UIImage imageNamed:@"bg_nav"];
        headBackIV.tag = 888888;
        UIImageView * headView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 20, SCREEN_WIDTH, 44)];
        headView.image = img;
        [headBackIV addSubview:headView];
        [self.currentShowVC.view addSubview:headBackIV];
    }
    return [super popViewControllerAnimated:YES];
}

上一篇下一篇

猜你喜欢

热点阅读