2

我可以选择显示 UIImagePicker 并在我的应用程序中从用户的相机胶卷中选择图像。我遇到的问题是照片按最旧的在顶部进行排序。这使得选择几个月前拍摄的图像变得容易。我希望用户快速选择几分钟前拍摄的图像,而无需滚动到列表末尾(列表底部)。

有没有要求默认的 UIImagePicker 对其结果进行排序并显示最新的结果,或者在呈现后至少滚动到列表的末尾?

- (BOOL) startCameraControllerFromViewController: (UIViewController*) controller
                                   usingDelegate: (id <UIImagePickerControllerDelegate,
                                                   UINavigationControllerDelegate>) delegate {

    if (([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera] == NO)
        || (delegate == nil)   
        || (controller == nil))
        return NO;


    UIImagePickerController *cameraUI = [[UIImagePickerController alloc] init];
    cameraUI.sourceType = UIImagePickerControllerSourceTypeCamera;

    // Displays a control that allows the user to choose picture or
    // movie capture, if both are available:
    cameraUI.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeImage];

    // Hides the controls for moving & scaling pictures, or for
    // trimming movies. To instead show the controls, use YES.
    cameraUI.allowsEditing = NO;

    cameraUI.delegate = delegate;
    [controller presentModalViewController: cameraUI animated: YES];
    return YES;
}
4

1 回答 1

2

如this question所示

该解决方案涉及在选择带有线条的图像之前添加一个额外的步骤:

imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;

这将显示可用照片库的列表并滚动到所选照片库的底部。

于 2012-07-27T14:03:21.723 回答