我有一个 UITableViewController,它弹出一个 UIImagePickerController,用户拍照,点击使用按钮,在处理图像时 Picker 关闭以显示自定义缩略图微调器,然后在处理结束时微调器被实际缩略图替换。
至少它在 iOS4 中是这样工作的。现在使用 iOS5,它只是坐在那里处理直到完成,然后一切正常。但是我想要那个微调器,这样用户就知道发生了什么事,否则它看起来就像挂了。
所以我有这个:
- (void) actionSheet: (UIActionSheet *)actionSheet didDismissWithButtonIndex (NSInteger)buttonIndex {
    UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    picker.allowsEditing = NO;
    // yada, yada, yada
    [self presentModalViewController:picker animated:YES];
    [picker release];
}
然后当用户选择“使用”时调用它:
- (void) imagePickerController: (UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    [self dismissModalViewControllerAnimated:YES];
    [self performSelectorOnMainThread:@selector(processImage:) withObject:info waitUntilDone:NO];
    animate = true;
}
然后在缩略图旋转时调用它来执行处理:
- (void) processImage:(NSDictionary *)info
{
    UIImage *image = nil;
    NSString* mediaType = [info objectForKey:UIImagePickerControllerMediaType];
    // processing of image
    animate = false;
    [activityImageView stopAnimating];
    [activityImageView release];
    [self.tableView reloadData];
}
就像我说的,它在 iOS4 上完美运行,但在 iOS5 上,就没有这样的运气了。那么有什么关系呢?图像选择器最终会被解散,那么为什么它不立即被解散呢?