For the UIImagePickerController, I opened the
picker.allowsEditing = YES;
so that user can move and scale the photo, after capturing or selecting from album. Once the "choose" or "use" is clicked, the whole app is frozen for more than 5 seconds, and then goes back with the photos, through
- (void)imagePickerController:(UIImagePickerController*)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
I tried to add an indicator in this delegate function, but it doesn't appear... I guess, the long delay happens before this callback, and is probably because of the "editing" from ful
Is there any possible way to handle this? I just wish to give the users a good experience. :)
Thanks a lot!!
You should perform this on another thread and with an NSAutoreleasePool, like so:
- (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];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With