gpt4 book ai didi

iphone - UIImagePickerController的didFinishPickingMediaWithInfo太慢,我可以添加progressHUD/indicator吗?

转载 作者:行者123 更新时间:2023-12-03 18:36:10 25 4
gpt4 key购买 nike

对于 UIImagePickerController,我打开了

picker.allowsEditing = YES;

以便用户在捕获或从相册中选择照片后可以移动和缩放照片。一旦点击“选择”或“使用”,整个应用程序就会卡住5秒以上,然后带着照片返回,通过

- (void)imagePickerController:(UIImagePickerController*)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info

我尝试在这个委托(delegate)函数中添加一个指示器,但它没有出现...我猜,长时间的延迟发生在这个回调之前,可能是因为来自 ful 的“编辑”

有什么办法可以解决这个问题吗?我只是想给用户一个好的体验。 :)

非常感谢!!

最佳答案

您应该在另一个线程上使用 NSAutoreleasePool 执行此操作,如下所示:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo {
[self.navigationController dismissModalViewControllerAnimated:YES];
[NSThread detachNewThreadSelector:@selector(uploadImage:) toTarget:self withObject:image];
}

- (void)uploadImage:(UIImage *)image {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
// Handle chosen photo
[pool release];
}

关于iphone - UIImagePickerController的didFinishPickingMediaWithInfo太慢,我可以添加progressHUD/indicator吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4703794/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com