swift - UiTableViewCell Dynamic height works on iphone not ipad size class -


so have any size class using iphone , regular regular ipad. being said have custom uitableviewcell , have cell auto sizing iphone. laid out constraints vertically know size cell should be.

the problem on ipad size class doing same thing, layout little different checked every element , has top , bottom , height constraint on yet uitableviewcell high iphone layout.

here code scene:

import uikit  class trucklistmainviewcontroller: uiviewcontroller, uitableviewdatasource, uitableviewdelegate {  var trucknames = ["this truck test"] var truckimages = ["default-truck.png"] var oneaverages = ["5.02"] var twoaverages = ["6.02"] var threeaverages = ["7.02"] var fouraverages = ["8.02"] var onelabels = ["30 day mpg"] var twolabels = ["60 day mpg"] var threelabels = ["90 day mpg"] var fourlabels = ["lifetime mpg"]  @iboutlet weak var trucklisttable: uitableview! @iboutlet weak var openmenu: uibarbuttonitem!  override func viewdidload() {     super.viewdidload()      // additional setup after loading view.     self.trucklisttable.rowheight = uitableviewautomaticdimension     self.trucklisttable.estimatedrowheight = 200.0      openmenu.target = self.revealviewcontroller()     openmenu.action = selector("rightrevealtoggle:")      self.view.addgesturerecognizer(self.revealviewcontroller().pangesturerecognizer())     self.view.addgesturerecognizer(self.revealviewcontroller().tapgesturerecognizer()) }  override func didreceivememorywarning() {     super.didreceivememorywarning()     // dispose of resources can recreated. }  func numberofsectionsintableview(tableview: uitableview) -> int {     // #warning potentially incomplete method implementation.     // return number of sections.     return 1 }  func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int {     // #warning incomplete method implementation.     // return number of rows in section.     return trucknames.count  }  func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell {     let cell = tableview.dequeuereusablecellwithidentifier("cell", forindexpath: indexpath) as! trucklist      // configure cell...     cell.truckname.text = trucknames[indexpath.row]     cell.truckimage.image = uiimage(named: truckimages[indexpath.row])     cell.averageone.settitle(oneaverages[indexpath.row], forstate: uicontrolstate.normal)     cell.averagetwo.settitle(twoaverages[indexpath.row], forstate: uicontrolstate.normal)     cell.averageone.settitle(threeaverages[indexpath.row], forstate: uicontrolstate.normal)     cell.averageone.settitle(fouraverages[indexpath.row], forstate: uicontrolstate.normal)     cell.labelone.settitle(onelabels[indexpath.row], forstate: uicontrolstate.normal)     cell.labeltwo.settitle(twolabels[indexpath.row], forstate: uicontrolstate.normal)     cell.labelthree.settitle(threelabels[indexpath.row], forstate: uicontrolstate.normal)     cell.labelfour.settitle(fourlabels[indexpath.row], forstate: uicontrolstate.normal)     return cell }  func tableview(tableview: uitableview, willdisplaycell cell: uitableviewcell, forrowatindexpath indexpath: nsindexpath) {      cell.backgroundcolor = uicolor.clearcolor()      if indexpath.row % 2 == 0 {          cell.backgroundcolor = uicolor(red: 202/255.0, green: 202/255.0, blue: 202/255.0, alpha: 1)     } else {          cell.backgroundcolor = uicolor(red: 240/255.0, green: 240/255.0, blue: 240/255.0, alpha: 1)     } }     /* // mark: - navigation  // in storyboard-based application, want little preparation before navigation override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject?) {     // new view controller using segue.destinationviewcontroller.     // pass selected object new view controller. } */  } 

any appreciated, wouldnt post on here have been struggling issue 2 days now. if post pictures would, know see constraints.

i checked every element , has top , bottom , height constraint on yet uitableviewcell high iphone layout

you may confused how cell heights determined. if don't want cell height determined internal constraints, need set table view's rowheight property actual number (not uitableviewautomaticdimension).


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -