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

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -