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

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

作者: 爱闹的凡 | 来源:发表于2018-03-14 18:10 被阅读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];
    }
    
    

    相关文章

      网友评论

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

          本文链接:https://www.haomeiwen.com/subject/ruqqqftx.html