Created
June 14, 2013 18:25
-
-
Save sergiosvieira/5784119 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Try to reduce the size of images | |
If you cannot reduce the size for any reasons, try the below code (operationQueue is an ivar of the instance of NSOperationQueue) | |
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"identifier"]; | |
[operationQueue addOperationWithBlock:^{ | |
NSString *imagePath = [[NSBundle mainBundle] pathForResource:@"name" ofType:@"jpg"]; | |
UIImage *image = [[UIImage alloc] initWithContentsOfFile:imagePath]; | |
[[NSOperationQueue mainQueue] addOperationWithBlock:^{ | |
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; | |
cell.imageView.image = image; | |
}]; | |
}]; | |
return cell; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment