ios - Custom table view cell image distorting -
ios - Custom table view cell image distorting -
i have custom uitableviewcell, have image well, image stretching rather unusually. here code:
var count = 0 var propic: nsstring = "" var name: nsstring = "" info in listdataarray { if(indexpath.row == count) { if allow pic = data["profile_pic"] as? nsstring { propic = pic } if allow n = data["full_name"] as? nsstring { name = n } } count++ } allow decodeddata = nsdata(base64encodedstring: propic, options: nsdatabase64decodingoptions(0)) var decodedimage = uiimage(data: decodeddata!) var cell:tableviewcell? = tableview.dequeuereusablecellwithidentifier("cell") as? tableviewcell if (cell == nil) { allow nib:array = nsbundle.mainbundle().loadnibnamed("tableviewcell", owner: self, options: nil) cell = nib[0] as? tableviewcell } cell!.namelabel!.text = name cell!.imageview!.image = decodedimage cell!.imageview!.layer.cornerradius = cell!.recipeimageview!.frame.size.width / 2 cell!.imageview!.layer.borderwidth = 5.0 cell!.imageview!.clipstobounds = true cell!.imageview!.layer.bordercolor = uicolor(red: 128/225.0, green: 188/225.0, blue: 163/225.0, alpha: 0.45).cgcolor; homecoming cell;
here .xib
and tableviewcell.swift
file:
@iboutlet var imageview : uiimageview? = uiimageview(frame: cgrectmake(10, 10, 50, 50)) @iboutlet var namelabel : uilabel? @iboutlet var timelabel : uilabel? override func awakefromnib() { super.awakefromnib() // initialization code } override func setselected(selected: bool, animated: bool) { super.setselected(selected, animated: animated) // configure view selected state }
and result in simulator:
i need images restricted block (and in circle) show this:
just except of beingness square images, need them circle. how can this?
you can add together library project using cocoapods platform :ios pod 'apavatarimageview'
and add together class apavatarimageview
uiimageview in storyboard or xib , automatically circle https://github.com/ankurp/apavatarimageview
ios uitableview swift
Comments
Post a Comment