Trigger a relayout once the media image of PostNode in SocialAppLayout is loaded

This commit is contained in:
Huy Nguyen
2015-11-17 18:09:16 +02:00
parent 59d52ced3f
commit 52c45cf5e3

View File

@@ -14,6 +14,9 @@
#import "LikesNode.h"
#import "CommentsNode.h"
@interface PostNode() <ASNetworkImageNodeDelegate>
@end
@implementation PostNode
- (instancetype)initWithPost:(Post *)post {
@@ -90,6 +93,7 @@
_mediaNode.backgroundColor = ASDisplayNodeDefaultPlaceholderColor();
_mediaNode.cornerRadius = 4.0;
_mediaNode.URL = [NSURL URLWithString:_post.media];
_mediaNode.delegate = self;
_mediaNode.imageModificationBlock = ^UIImage *(UIImage *image) {
UIImage *modifiedImage;
@@ -258,4 +262,12 @@
[[UIApplication sharedApplication] openURL:URL];
}
#pragma mark -
#pragma mark ASNetworkImageNodeDelegate methods.
- (void)imageNode:(ASNetworkImageNode *)imageNode didLoadImage:(UIImage *)image
{
[self setNeedsLayout];
}
@end