Emil
Emil

Reputation: 126

Scale to fit cuts image

I have an UIImageView with the image of a gradient with a thin line at the bottom. As the image isn't the same size as the imageview I want to scale it in some way. I don't care if I stretch the image but I would like the line at the bottom to be visible. Therefore I chose "Scale To Fill". But as you can see on the second screenshot the bottom line is not showing up in the simulator.

I thought that "Scale to fill" meant that the image got stretched so that all content is visible but that doesn't seem to be the case.

I highly appreciate your answers!

enter image description here

enter image description here

Upvotes: 1

Views: 305

Answers (1)

matt
matt

Reputation: 535790

As the image isn't the same size as the imageview I want to scale it in some way. I don't care if I stretch the image

So use a resizable image (resizableImageWithCapInsets:). This is exactly what it is for.

but I would like the line at the bottom to be visible.

Well, there are some extra complications here, and you are not explaining how you are handling them. You have a UIImageView; it has a size. Perhaps it is bigger than the view we are seeing in the screen shot. Perhaps it is being overlapped by the text view that we see below it. In other words, it matters how this image view is being placed in the interface and sized.

Upvotes: 1

Related Questions