Skip to content

Instantly share code, notes, and snippets.

@Cellane
Created December 7, 2013 15:00
Show Gist options
  • Save Cellane/7843611 to your computer and use it in GitHub Desktop.
Save Cellane/7843611 to your computer and use it in GitHub Desktop.
-(void)loadImageWithIndex:(int)index toPage:(int)pageIndex{
if (pageIndex == 0)
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^
{
UIImage *pom = [UIImage imageNamed:[self.imageNameArray objectAtIndex:(NSUInteger) index]];
dispatch_async(dispatch_get_main_queue(), ^
{
self.imageViewOne.image = pom;
if (self.imageViewOne.hidden)
{
self.imageViewOne.hidden = NO;
[UIView animateWithDuration:0.3 animations:^
{
self.imageViewOne.alpha = 1;
}];
}
});
});
}
if (pageIndex == 1)
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^
{
UIImage *pom = [UIImage imageNamed:[self.imageNameArray objectAtIndex:(NSUInteger) index]];
dispatch_async(dispatch_get_main_queue(), ^
{
self.imageViewTwo.image = pom;
if (self.imageViewTwo.hidden)
{
self.imageViewTwo.hidden = NO;
[UIView animateWithDuration:0.3 animations:^
{
self.imageViewTwo.alpha = 1;
}];
}
});
});
}
if (pageIndex == 2)
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^
{
UIImage *pom = [UIImage imageNamed:[self.imageNameArray objectAtIndex:(NSUInteger) index]];
dispatch_async(dispatch_get_main_queue(), ^
{
self.imageViewThree.image = pom;
if (self.imageViewThree.hidden)
{
self.imageViewThree.hidden = NO;
[UIView animateWithDuration:0.3 animations:^
{
self.imageViewThree.alpha = 1;
}];
}
});
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment