Last active
February 8, 2018 08:12
-
-
Save duannguyenle/c9f525a013a145b81918c843b512631d to your computer and use it in GitHub Desktop.
YangMingShan bug: Load Photo with network access allowed
This file contains hidden or 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
// In YMSPhotoCell class | |
- (void)loadPhotoWithManager:(PHImageManager *)manager forAsset:(PHAsset *)asset targetSize:(CGSize)size | |
{ | |
self.imageManager = manager; | |
PHImageRequestOptions *options = [[PHImageRequestOptions alloc] init]; | |
options.deliveryMode = PHImageRequestOptionsDeliveryModeHighQualityFormat; | |
options.networkAccessAllowed = YES; | |
options.resizeMode = PHImageRequestOptionsResizeModeExact; | |
options.synchronous = NO; | |
self.imageRequestID = [self.imageManager requestImageForAsset:asset | |
targetSize:size | |
contentMode:PHImageContentModeAspectFill | |
options:options | |
resultHandler:^(UIImage *result, NSDictionary *info) { | |
// Set the cell's thumbnail image if it's still showing the same asset. | |
if ([self.representedAssetIdentifier isEqualToString:asset.localIdentifier]) { | |
self.thumbnailImage = result; | |
} | |
}]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment