Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixes for reloadData #3

Merged
merged 1 commit into from

2 participants

@dnstevenson

fixed reloadData so that it clears previously loaded images and starts with a clean slate.

@bjhomer bjhomer merged commit 57dfcdd into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 22, 2011
  1. @dnstevenson
This page is out of date. Refresh to see the latest.
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];
}
Something went wrong with that request. Please try again.