how to set image in top avoiding space in UIimageView

前端 未结 3 1890
孤城傲影
孤城傲影 2021-01-13 21:00

I\'ve an UIImageView with content mode Aspect Fit of size 220x155. I\'m dynamically inserting different images in different resolutions, but all larger than the size of the

3条回答
  •  礼貌的吻别
    2021-01-13 21:28

    Its very simple, you just need to get image actual size, which can be done by

    UIImage *image = [UIImage imageName:@""];
    

    then you just need to set frame Like :-

    imageView.frame = CGRectMake(0.0, 0.0, image.size.width, image.size.height);
    

    Hope this helps you.

提交回复
热议问题