didFinishPickingMediaWithInfo中的iOS presentViewController导致app滞后

时间:2012-12-15 12:03:36

标签: ios uiimagepickercontroller

在我的应用程序中,我执行以下序列:

1)我使用设备相机拍摄图像

2)在didFinishPickingMediaWithInfo我收回图片时,我会关闭UIImagePickerController并提出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对其进行了压缩,但结果没有改变。

有谁知道为什么会这样?

0 个答案:

没有答案