0

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?

Paul A.
  • 577
  • 2
  • 11
  • 24
  • Have you tried changing the contentMode? Try with a different contentMode option such as UIViewContentModeScaleAspectFill or so. Check this post as well http://stackoverflow.com/questions/3182649/ios-sdk-uiviewcontentmodescaleaspectfit-vs-uiviewcontentmodescaleaspectfill – iDev Oct 09 '12 at 19:45
  • Yes, I already tried that but the result was the same. I think I need to change the dimensions of the imageView frame? – Paul A. Oct 09 '12 at 19:58

0 Answers0