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

Pham Minh Dat
Pham Minh Dat
1,873 Points

Resize image

Hello, I cannot resize the image in swift. I've tried every options in Size Inspector but those are like crop, not resize. Does anyone know how to do it? Many thanks in advance!

2 Answers

Greg Kaleka
Greg Kaleka
39,021 Points

In the size inspector, you should be able to set the height and width of a UIImageView directly. Alternatively, you can set height and width constraints from the constraints menus in the bottom right corner of the storyboard.

It's not 100% clear what you're trying to do, so let me know if that doesn't answer your question.

Cheers,

Greg

Pham Minh Dat
Pham Minh Dat
1,873 Points

Hi Greg,

Thank you for your reply. For example, I have an 200*200px image but i want to resize it to 100*100px or some % to fit the content nicely without cropping out the edges.