ios - Can't put image inside tableviewcell -
i have other tables working ok, 1 not working. image dont stay inside cell (see little lines):
i want this:
the mode aspect fit, ive tried , nothing seems work.
my code:
import uikit import parse class pratosviewcontroller: uiviewcontroller,uitableviewdatasource,uitableviewdelegate { var restauranterow: pfobject! @iboutlet var tableview: uitableview! @iboutlet var scroller: uiscrollview! @iboutlet var titulorestaurante: uilabel! @iboutlet var imagemrestaurante: uiimageview! override func viewdidload() { super.viewdidload() scroller.contentinset = uiedgeinsetsmake(0, 0, 400, 0) navigationcontroller?.navigationbar.tintcolor = uicolor.blackcolor() titulorestaurante.text = restauranterow["nome"] as? string } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } override func viewwilllayoutsubviews() { super.viewwilllayoutsubviews() self.scroller.frame = self.view.bounds self.scroller.contentsize.height = 400 self.scroller.contentsize.width = 0 } //tableview func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int { return 1 } func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { var cell = self.tableview.dequeuereusablecellwithidentifier("ceculapratos") as! pratostableviewcell let imagem = restauranterow["imagem1"] as! pffile imagem.getdatainbackgroundwithblock { (imagedata: nsdata?, error: nserror?) -> void in if (error == nil) { cell.imagemcelula.image = uiimage(data:imagedata!) } } return cell } }
create custom cell , add autolayout constraints satisfy image dimension inside cell
Comments
Post a Comment