I have a problem resizing images from web service (in code below i'm trying to get 400*266 down to 300*200). In detail view controller's viewDidLoad I add scroll view and image view. Then I add image to image view and change the size of image view's frame. Result is 300*100 image. Height is always about half of what I want. But if I change dimensions manually in storyboard (not useful for different image dimensions) it works like a charm. What am I missing?
@interface DetailVIewController () <UIScrollViewDelegate>
@property (weak, nonatomic) IBOutlet UIScrollView *scrollView;
@property (weak, nonatomic) IBOutlet UIImageView *imageView;
....
//adding image and resizing imageview's frame
UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:someURL]]];
imageView.image = image;
self.imageView.frame = CGRectMake(10, 20, 300, 200);
....
//further down the code (if it's an issue):
CGSize size = {screenWidth, screenHeight};
self.scrollView.delegate = self;
self.scrollView.contentSize = size;