Strange behaviour with UIImageView with camera pictures, all zoomed in

135 Views Asked by At

I have a strange behaviour which suggests I might just be missing something. I have the following code:

UIImage *anyImage = [UIImage imageWithContentsOfFile:path];
self.imageView   = [[UIImageView alloc] initWithImage:newImage];
[self.imageView setImage:newImage];
self.imageView.center = self.view.center;
self.imageView.contentMode = UIViewContentModeScaleAspectFit;
self.imageView.userInteractionEnabled=YES;
self.imageView.clipsToBounds=YES;
[self.view addSubview:self.imageView];

When anyImage is a smaller size picture, downloaded from the internet, it displays correctly. However, when anyImage is a picture taken from my iPhone camera, it is zoomed-in and only shows a part of the picture enlarged, covering the entire window. I have tried different approaches to resize the imageView but it has no effect. So for example, a picture of a person might have the head or part of the body all zoomed in to cover the entire window and the rest of the body not shown. How can I resolve this problem?

0

There are 0 best solutions below