ios - How come my section headers only disappear on larger devices? -
it works on phones width of 320 iphone 4 , 5. when test on simulator 6 , however, uitableview section headers no longer visible reason. here relevant code:
func numberofsectionsintableview(tableview: uitableview) -> int { return 3 } func tableview(tableview: uitableview, viewforheaderinsection section: int) -> uiview? { let headerview = uiview(frame: cgrectmake(0, 0, self.tableview.frame.size.width, 30)) headerview.backgroundcolor = uicolor(red:0.20, green:0.47, blue:0.45, alpha:1.00) let sectionlabel = uilabel(frame: cgrectmake(0, 0, self.tableview.frame.size.width, 30)) switch section { case 0: sectionlabel.text = "monday friday" case 1: sectionlabel.text = "saturday" case 2: sectionlabel.text = "sunday" default: sectionlabel.text = "" } sectionlabel.font = uifont(name:"helveticaneue-bold", size: 16.0) sectionlabel.textcolor = uicolor.whitecolor() sectionlabel.textalignment = nstextalignment.center; headerview.addsubview(sectionlabel) return headerview } func tableview(tableview: uitableview, heightforheaderinsection section: int) -> float { return 30.0 }
before tap on first tableview cell...
Comments
Post a Comment