在我的应用程序中,我需要从照片库中选择图像,我有数百张照片。问题是Camera拍摄的最新照片,保存在照片库的底部,因此,我必须向下滚动以选择我拍摄的最新照片。有什么办法可以将ImagePickerViewController的视图滚动到底部,还是可以将最新的图片存储在顶部?
答案 0 :(得分:4)
[self presentViewController:imagePickerController animated:YES completion:^()
{
UIView *imagePickerView = imagePickerController.view;
UIView *view = [imagePickerView hitTest:CGPointMake(5,5) withEvent:nil];
while (![view isKindOfClass:[UIScrollView class]] && view != nil)
{
view = [view superview];
}
if ([view isKindOfClass:[UIScrollView class]])
{
UIScrollView *scrollView = (UIScrollView *) view;
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];
}
}];