Skip to content
Browse files

GCD for loading FGallery view

  • Loading branch information...
1 parent 37ef4e3 commit 3b156e92e8a710843d9b041bd0f0c94f015c3e97 @rogmabi committed Oct 6, 2011
Showing with 19 additions and 11 deletions.
  1. +19 −11 FGallery/Classes/FGalleryViewController.m
View
30 FGallery/Classes/FGalleryViewController.m
@@ -227,17 +227,6 @@ - (void)loadView
// create layer for the thumbnails
_isThumbViewShowing = NO;
- // create the image views for each photo
- [self buildViews];
-
- // create the thumbnail views
- [self buildThumbsViewPhotos];
-
- // start loading thumbs
- if ([_photoViews count]) {
- [self preloadThumbnailImages];
- }
-
}
- (void)viewWillAppear:(BOOL)animated
@@ -258,6 +247,25 @@ - (void)viewWillAppear:(BOOL)animated
else [self gotoImageByIndex:_currentIndex animated:NO];
}
+- (void)viewDidAppear:(BOOL)animated {
+ // let's do this in a new thread
+ dispatch_queue_t thumbViewQueue = dispatch_queue_create("ThumbViewQueue", NULL);
+ dispatch_async(thumbViewQueue, ^{
+ // tell thumbs that havent loaded to load
+ // create the image views for each photo
+ [self buildViews];
+
+ // create the thumbnail views
+ [self buildThumbsViewPhotos];
+
+ // start loading thumbs
+ if ([_photoViews count]) {
+ [self preloadThumbnailImages];
+ }
+ });
+ dispatch_release(thumbViewQueue);
+}
+
- (void)viewWillDisappear:(BOOL)animated
{
_isActive = NO;

0 comments on commit 3b156e9

Please sign in to comment.
Something went wrong with that request. Please try again.