Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Implementing Designs for iPhone Using Auto Layout and Managing the Keyboard Handling Views Covered by the Keyboard

Jacob McLaws
Jacob McLaws
1,497 Points

All the photos I receive on Ribbit are stretched.

I think this is because the viewer is rendering the photos full screen while the camera is only shooting photos for a smaller section of the screen. How might I adjust this?

By changing the UIImageView content mode.

Click on the UIImageView and in the inspector choose Under View -> Mode -> Aspect Fill. This will make sure to fit the image within the given UIImageView by zooming only enough so to not show any of the background colour you may have set for the UIImageView.

By default the Mode is set to Scale To Fill, you could also change the content mode in code if you prefer, with self.backgroundImageView.contentMode = UIViewContentModeScaleAspectFill; <- within your -viewDidLoad

Either way should return the desired results, hope this helped.

1 Answer

Michiel Lauret
Michiel Lauret
1,202 Points

I had the same problem. I changed the line in CameraViewController to

UIImage *newImage = [self resizeImage:self.image toWidth:640 andHeight:960]; (changed the width and height).

That fixed it for me, but I'm not sure if these are the correct values.