你基本上可以做的是在你关闭它之前将你的 UIActivityInidicatior 添加到 UIImagePicker 视图中。
这是我在用户按下使用按钮后压缩图像时正在做的类似事情。注意 NSTimer - 这是一个让 iphone 真正显示您正在添加的 UI 的绝妙技巧:在 didFinishPickingImage 上:
//this will add the UIActivityInidicatior to the picker view
(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo {
showActivity(@"Compressing Image", picker.view);
//this is a hack so the progress label will show up
[NSTimer scheduledTimerWithTimeInterval: 0.0f
target: self
selector: @selector(compress:)
userInfo: image
repeats: NO];
}
//the Compress method
(void) compress:(NSTimer *)inTimer {
NSAutoreleasePool *_pool = [[NSAutoreleasePool alloc] init];
//do some work
[[self getPicker] dismissModalViewControllerAnimated:YES];
//dismiss the view we added to the picker
showActivity(nil, [self getPicker].view);
[_pool release];
}
请注意,我保留了UIImagePickerController
外部,因此我可以从调用的消息中引用它。
showActivity
是一种向给定视图添加一些 UI 的简单方法。