ios - how can i keep image size in tableview? -


this when launch app

enter image description here

after click on cell images bigger

enter image description here

my code this

override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell {     let cell = tableview.dequeuereusablecellwithidentifier("mycell", forindexpath: indexpath)       // configure cell...     cell.imageview?.sd_setimagewithurl(nsurl(string: imagearray[indexpath.row]), placeholderimage:uiimage(named: "pin.png"))    cell.imageview?.frame = cgrectmake(0, 0, 50, 50)     return cell } 

imagearray string of image urls. please help

thanks in advance

you can try use contant mode property:

imageviewobject.contentmode = uiviewcontentmode.scaletofill 

or

imageviewobject.contentmode = uiviewcontentmode.scaleaspectfit 

or

imageviewobject.contentmode = uiviewcontentmode.scaleaspectfill  

Comments

Popular posts from this blog

many to many - Django Rest Framework ManyToMany filter multiple values -

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

Java Entity Manager - JSON reader was expecting a value but found 'db' -