`

Unbalanced calls to begin/end appearance transitions for

 
阅读更多

执行以下代码的时候:

[self dismissViewControllerAnimated:NO completion:nil];
UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];// 用户选择的图片
CropImageViewController *cropViewController = [[CropImageViewController alloc] initWithImage:image andImageScale:1.25];
cropViewController.delegate = self;
[self.navigationController pushViewController:cropViewController animated:NO];

控制台显示警告:Unbalanced calls to begin/end appearance transitions for

原因是dismissViewController还没有执行完,就开始执行pushViewController,动画有冲突,解决的办法是,把push写到dismiss的completion block里

[self dismissViewControllerAnimated:NO completion:^{
        UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];// 用户选择的图片
        CropImageViewController *cropViewController = [[CropImageViewController alloc] initWithImage:image andImageScale:1.25];
        cropViewController.delegate = self;
        [self.navigationController pushViewController:cropViewController animated:NO];
    }];




分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics