Điều này làm tôi khó chịu rất nhiều - tôi gần như triển khai bộ chọn hình ảnh tùy chỉnh của riêng tôi bằng AssetsLibrary.
Nhưng trong thời gian chờ đợi, bản hack này hoạt động cho tôi - tôi đang hiển thị bộ chọn, tìm kiếm dạng xem cuộn trong cấu trúc phân cấp, và di chuyển đến cuối, nhiều hơn hoặc ít hơn. Nó cần phải được hoạt hình vì điều này xảy ra khi chế độ xem đã được tải - nhưng vẫn tốt hơn người dùng phải cuộn qua 5.000 ảnh cho đến khi họ xem được ảnh mới nhất.
[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];
}
}];
đó là Whack, chỉ nói. cảm ơn người đàn ông. – nickthedude