0

I am creating an image from a byte array using a UIImageView control. I need to ensure that the max size of the image is 600 x 600. How can I do that? I have tried SizeThatFits() and SizeToFit(), however, that just moves the image around on the screen. I have tried setting the Bound property to new RectangleF(0, 0, 600, 600), however, that also does no good.

Joseph Anderson
  • 4,114
  • 4
  • 45
  • 99

1 Answers1

1

You could check UIImage Size property for exceeding your limits. If so, scale it:

const int limit = 600;
if ((View.Frame.Size.Width > limit) || (View.Frame.Size.Height > limit))
{
    // Scale as on link above.
}

Alternatively, you could set Frame and ContentMode of your UIImageView to desirable values.

Community
  • 1
  • 1
Maxim Korobov
  • 2,574
  • 1
  • 26
  • 44