Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed reloadData so that it clears previously loaded images and start…

…s with a clean slate.
  • Loading branch information...
commit 833853eb8fcfcb78fc675f1e962d39c8e0f41f48 1 parent 8661139
@dnstevenson dnstevenson authored
Showing with 11 additions and 1 deletion.
  1. +11 −1 Classes/HSImageSidebarView.m
View
12 Classes/HSImageSidebarView.m
@@ -252,11 +252,21 @@ - (void)recalculateScrollViewContentSize {
- (void) reloadData {
NSUInteger imageCount = [delegate countOfImagesInSidebar:self];
-
+
+ // clear out the previous imageViews so we get a fresh array to fill
+ [imageViews removeAllObjects];
for (NSUInteger i=0; i<imageCount; ++i) {
[imageViews addObject:[NSNull null]];
}
+ // remove all previous images that were loaded
+ NSArray *subViews = [_scrollView subviews];
+ for (UIView *view in subViews) {
+ if ([view isKindOfClass:[UIImageView class]]) {
+ [view removeFromSuperview];
+ }
+ }
+
[self recalculateScrollViewContentSize];
[self setNeedsLayout];
}
Please sign in to comment.
Something went wrong with that request. Please try again.