Media Library #1: Grid and detail views#6842
Merged
Conversation
| self.imageView.image = self.image; | ||
| [self.media imageWithSize:CGSizeZero completionHandler:^(UIImage *result, NSError *error) { | ||
| dispatch_async(dispatch_get_main_queue(), ^{ | ||
| if (error) { |
Contributor
There was a problem hiding this comment.
If you are using weakSelf several times it may be safer to first to convert to strongSelf.
| [_imageView setImageWithURLRequest:[NSURLRequest requestWithURL:self.url] | ||
| placeholderImage:self.image | ||
| success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) { | ||
| weakSelf.image = image; |
Contributor
There was a problem hiding this comment.
If you are using weakSelf several times it may be safer to first to convert to strongSelf.
Contributor
Author
There was a problem hiding this comment.
I don't think it'll matter here? If self has been dealloc'd (the view controller has gone away), then these will all just reference nil and nothing will happen.
Contributor
There was a problem hiding this comment.
I concur that we would want to allow for nil if deallocated via weakSelf.
Contributor
|
The main issue is if the reference goes away in the middle of the operations and you can get half work done.
…Sent from my iPhone
On 9 Mar 2017, at 15:33, James Frost ***@***.***> wrote:
@frosty commented on this pull request.
In WordPress/Classes/ViewRelated/Reader/WPImageViewController.m:
> +{
+ self.imageView.image = self.image;
+ [self.imageView sizeToFit];
+ self.scrollView.contentSize = self.imageView.image.size;
+ [self centerImage];
+}
+
+- (void)loadImageFromURL
+{
+ self.isLoadingImage = YES;
+
+ __weak __typeof__(self) weakSelf = self;
+ [_imageView setImageWithURLRequest:[NSURLRequest requestWithURL:self.url]
+ placeholderImage:self.image
+ success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) {
+ weakSelf.image = image;
I don't think it'll matter here? If self has been dealloc'd (the view controller has gone away), then these will all just reference nil and nothing will happen.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Contributor
Author
|
Cool, thanks @kurzee! More coming soon! |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issues: #6817 and #4528
Here's our first PR towards adding Media Library functionality to WPiOS. The Media Library is currently feature flagged so it'll only show in debug mode.
This PR adds:
What's not in here yet:
Needs review: @kurzee