Reputation: 3984
I'm calling a view (that contains just an ImageView) passing the picture's path from library's user. And then, on viewdidload I'm loading the image. But, the image is getting a "super zoom" on the upper right corner of the picture, I don't know why!
- (void)viewDidLoad
{
[super viewDidLoad];
self.navigationController.navigationBar.translucent = NO;
UIImage *picture = [UIImage imageWithContentsOfFile: self.picturePath];
UIImageView* imageView = [[UIImageView alloc] initWithImage:picture];
imageView.contentMode = UIViewContentModeScaleAspectFit;
[self.view addSubview:imageView];
}
Upvotes: 1
Views: 71
Reputation: 5818
Based on your comment, the image you are loading is very large. The UIImageView
that you're creating is taking on the width/height of the image. You can either set the frame of imageView, or use and IBOutlet
from your nib to add the photo to an existing UIImageView
.
In your code you're creating a new UIImageView
, so your updated code would look like:
- (void)viewDidLoad
{
[super viewDidLoad];
self.navigationController.navigationBar.translucent = NO;
UIImage *picture = [UIImage imageWithContentsOfFile: self.picturePath];
UIImageView* imageView = [[UIImageView alloc] initWithImage:picture];
// Set your frame size
imageView.frame = CGRectMake(0.0, 0.0, 320.0, 320.0);
imageView.contentMode = UIViewContentModeScaleAspectFit;
[self.view addSubview:imageView];
}
Upvotes: 1