美文网首页
更换头像时自定义截取相机拍摄图片--状态栏消失问题

更换头像时自定义截取相机拍摄图片--状态栏消失问题

作者: biyu6 | 来源:发表于2018-02-07 15:10 被阅读0次

    采用系统的更换头像方法,编辑时图片的最上方或者最下方总是无法拖到截取框中,故而自有自定义。自定义的方法有很多,按照与微信类似的,选中照片后推送到下一页,再点击截取,返回头像页时,状态栏会消失。下面是解决办法,特此记录一下:

    - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
    //获取原始图片---不允许系统裁剪,采用自定义裁剪
        UIImage *img = [info objectForKey:UIImagePickerControllerOriginalImage];
     UIImage *portraitImg = ;//处理图片大小的方法
    
    //自定义截取图片的控制器
    BYPhotoInterceptionVC *photoInterceptionVC = [[BYPhotoInterceptionVC alloc]init。。。。。];
        photoInterceptionVC.delegate = self;
    
    //推送到自定义截取的控制器
     [picker pushViewController: photoInterceptionVC animated:YES];
    
    }
    
    //判断是不是相机,如果是显示状态栏,并设置状态栏的Style
    #pragma mark - UINavigationControllerDelegate
    - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
        if ([navigationController isKindOfClass:[UIImagePickerController class]] &&
            ((UIImagePickerController *)navigationController).sourceType == UIImagePickerControllerSourceTypeCamera) {
            [[UIApplication sharedApplication] setStatusBarHidden:NO];
            [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:NO];
        }
    }
    
    

    相关文章

      网友评论

          本文标题:更换头像时自定义截取相机拍摄图片--状态栏消失问题

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