ios - Swift scaleAspectFill only width -
i have got uiimageview
in swift
let background_image: uiimageview = { let v = uiimageview() v.image = #imageliteral(resourcename: "basketball") v.contentmode = .scaletofill v.translatesautoresizingmaskintoconstraints = false return v }()
what want here have image fill background without getting smaller or bigger. imagine image background
what want 100x100 px of image , show that. in image.
for crop image center have set content mode center , allow image clips bound prevent image view size
imageview.contentmode = .center /* take center part of image*/ imageview. clipstobounds = true /* prevent image view size*/
Comments
Post a Comment