ios - UITableViewController swift different sizes of height with images -
i have uitableviewcontroller
has 2 cells , when put photo in it, comes out same size. coding put in viewcontroller.swift is
import uikit class tableviewcontroller: uitableviewcontroller { var imagearray = ["1.png","2.png"] override func viewdidload() { super.viewdidload() } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell = tableview.dequeuereusablecellwithidentifier("cell") uitableviewcell! let imageview = cell.viewwithtag(2) as! uiimageview imageview.image = uiimage(named: imagearray[indexpath.row]) return cell } override func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int { return imagearray.count } }
i'm not sure of looking for? if want 2 cells differents height, should try override
override func tableview(_ tableview: uitableview, heightforrowatindexpath indexpath: nsindexpath) -> cgfloat { }
in delegate.
Comments
Post a Comment