在我的应用程序中,我执行以下顺序:
1)我用设备相机拍照
2)在didFinishPickingMediaWithInfo
我取回图像中,我关闭UIImagePickerController
并呈现 a viewController
,就像这样
[self dismissViewControllerAnimated:YES completion:^(void){
[self presentNewViewController];
}];
presentNewViewcontroller 看起来像这样
- (void) presentNewViewController {
newViewController* newVC = [[newViewController alloc]init];
[newVC setImage: selectedImage]; //selected Image comes from didFinishPickingMediaWithInfo
[self presentViewController:newVC animated:YES completion:nil];
}
这意味着在UIImagePickerController
被解雇后,我会立即展示一个新的控制器。
此操作在模拟器上运行良好,但在设备上会导致应用程序滞后。首先,我必须等待 2-3 秒,然后新的viewController
开始出现,即便如此,它的动画运行缓慢且碎片化,不流畅。
起初我认为选择的图像太大,但后来我使用它压缩UIImageJPEGRepresentation
但结果没有改变。
有谁知道为什么会这样?