Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,019 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.