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 enter image description here

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

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

.htaccess - ERR_TOO_MANY_REDIRECTS htaccess -