UIImagepickercontroller:是否可以改变相机胶卷中图像的sorting顺序?

基本上,如果用户不需要滚动到相机底部滚动来获取最近的照片,我想要最新的顶部,那么这个应用程序的工作将是一个很less的痛苦,不会无论如何有意义吗? 不知道为什么苹果这样devise,或者如果我只是没有意识到什么。

谢谢

缺口

如果您不介意在专辑列表中添加一个从相册列表中select相机胶卷的额外步骤,则可以尝试将您的源types从SavedPhotoAlbums更改为PhotoLibrary:

imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 

select所需的相册后,下一张照片select视图将在底部显示最近的图像。

这让我非常恼火 – 我正在接近使用AssetsLibrary来实现我自己的自定义图像select器。

但在此期间,这个黑客工作对我来说 – 我显示select器,search视图层次结构中的滚动视图,并滚动到底,或多或less。 当视图已经被加载的时候,需要进行animation处理,但是仍然比用户滚动浏览5000张照片要好,直到他们到达最新的。

  [self presentViewController:self.imagePickerController animated:YES completion:^() { // scroll to the end - hack UIView *imagePickerView = imagePickerController.view; UIView *view = [imagePickerView hitTest:CGPointMake(5,5) withEvent:nil]; while (![view isKindOfClass:[UIScrollView class]] && view != nil) { // note: in iOS 5, the hit test view is already the scroll view. I don't want to rely on that though, who knows // what Apple might do with the ImagePickerController view structure. Searching backwards from the hit view // should always work though. //NSLog(@"passing %@", view); view = [view superview]; } if ([view isKindOfClass:[UIScrollView class]]) { //NSLog(@"got a scroller!"); UIScrollView *scrollView = (UIScrollView *) view; // check what it is scrolled to - this is the location of the initial display - very important as the image picker // actually slides under the navigation bar, but if there's only a few images we don't want this to happen. // The initial location is determined by status bar height and nav bar height - just get it from the picker CGPoint contentOffset = scrollView.contentOffset; CGFloat y = MAX(contentOffset.y, [scrollView contentSize].height-scrollView.frame.size.height); CGPoint bottomOffset = CGPointMake(0, y); [scrollView setContentOffset:bottomOffset animated:YES]; } }]; 

没有办法以这种方式定制UIImagePickerController,但从iOS 4.0开始,基本上可以使用AssetsLibrary框架以任何方式构build自己的图像select器。

您可以使用ALAsset获取图像,然后根据需要对其进行sorting,并在表视图或collectionview中使用,以构build您自己的自定义相册