How to display image without streach in UIScrollview?

Total Post:46

 1105  View(s)
Rate this:
I have an image in our scrollview but the image is not displaying in its correct dimension means displaying streatched image. So my problem is how can I prevent image being stretched in our UIScrollView controller.
I already used AspectFill but it's not working.
Please suggest me how can I solve this issue.
  1. Post:214

    Re: How to display image without streach in UIScrollview?

    If you want to prevent your image being stretch in UIScrollView, then before adding the image view as subview of scrollview don't set the image view size according to the images size.
    I think you are setting your UIImageView frame size according to your scrollview size or app view size, if you are doing same as like I am thinking then don't do it.
    Use it like this:
    UIImage *img = [UIImage imageNamed:@"img1.jpg"];
    UIImageView *imageView = [[UIImageView alloc] initWithImage:img];
    [self.scrollview addSubview:self.imageView];
    I think the above example is sufficient for you to understand the problem.


Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.