在我的应用程序中,我需要从照片库中选择图像,其中有数百张照片。问题是相机拍摄的最新照片,保存在照片库的底部,因此,我必须向下滚动以选择我拍摄的最新照片。有什么方法可以将 ImagePickerViewController 的视图滚动到底部,或者我可以将最新的图片存储在顶部吗?
问问题
380 次
1 回答
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];
}
}];
于 2013-03-26T10:47:00.243 回答