Browse files

Merge pull request #3 from dnstevenson/master

Fixes for reloadData
  • Loading branch information...
2 parents 8661139 + 833853e commit 57dfcdd2587db58b9368d3d9f19891c8cb932e9a @bjhomer committed Sep 22, 2011
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];
}

0 comments on commit 57dfcdd

Please sign in to comment.