iPhone如何使用默认的UIImagePicker选择最新拍摄的图像

时间:2012-07-24 18:45:33

标签: iphone objective-c ios sorting uiimagepickercontroller

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

0 个答案:

没有答案