Why scale to fill give bigger image than UIImageVIew size? (using swift)

前端 未结 5 1085
天涯浪人
天涯浪人 2021-01-31 18:23

I\'m trying to showing a list of place name, including it\'s photo using PFQueryTableViewController. It\'s included in ParseUI SDK from parse.com

I have man

5条回答
  •  执笔经年
    2021-01-31 18:52

    From apple doc:

    UIViewContentModeScaleToFill

    Scales the content to fit the size of itself by changing the aspect ratio of the content if necessary

    UIViewContentModeScaleAspectFill

    Scales the content to fill the size of the view. Some portion of the content may be clipped to fill the view’s bounds.

    So your options are to use

    • UIViewContentModeScaleToFill, and possibly change the aspect ratio of displayed image,
    • UIViewContentModeScaleAspectFill, and use clipToBounds = YES on your PFImageView, to clip portions of image out of bounds.

提交回复
热议问题