【问题标题】:iPhone how to pick a latest taken image with default UIImagePickeriPhone如何使用默认的UIImagePicker选择最新拍摄的图像
【发布时间】:2012-07-24 18:45:32
【问题描述】:

我可以选择显示 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;
}

【问题讨论】:

标签: iphone objective-c ios sorting uiimagepickercontroller


【解决方案1】:

This question所示

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

imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-12-21
    • 1970-01-01
    • 2017-06-02
    • 1970-01-01
    • 2012-07-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多