Permalink
Browse files

default to Aspect Fit and no self auto-resizing for CLCGImageView

  • Loading branch information...
1 parent aa207a9 commit 3e8944d85227a1912ea2f5c123fcbdc0661773c5 @ettore committed Dec 20, 2012
Showing with 20 additions and 0 deletions.
  1. +20 −0 CLCGImageView.m
View
@@ -13,6 +13,7 @@
#import "clcg_device_utils.h"
#import "CLCGImageView.h"
+
@implementation CLCGImageView
@@ -27,6 +28,18 @@ -(void)dealloc
}
+-(id)initWithFrame:(CGRect)frame
+{
+ self = [super initWithFrame:frame];
+ if (self) {
+ [self setAutoresizesSubviews:YES];
+ [self setAutoresizingMask:UIViewAutoresizingNone];
+ [self setContentMode:UIViewContentModeScaleAspectFit];
+ }
+ return self;
+}
+
+
-(void)addTarget:(id)target onTapAction:(SEL)action
{
mTapAction = action;
@@ -60,6 +73,13 @@ -(void)loadImageForURL:(NSString*)normalurl retinaURL:(NSString*)retinaurl
block:^(UIImage *img, int http_status) {
if (img) {
[self setImage:img];
+
+ //TODO we should resize the image view
+ //accordingly to `img` size. But if we're
+ //not sure to always get retina images
+ //this could lead to displaying an
+ //image that's too big or too small.
+
} else {
CLCG_P(@"Error loading image. HTTP status=%d",
http_status);

0 comments on commit 3e8944d

Please sign in to comment.