ios - Swift - Expand tableview without Storyboard segue -


i trying create similar tableview 1 below:

https://github.com/justinmfischer/swiftyexpandingcells

i have complete tableview contents, including filtering system. current problem want implement same functionality expand cells , show detailed information, without using storyboard.

the sample code (link) uses storyboard segue, want rid of can same thing through code. removed label background. want title , new controller first clicking tableview cell.

detailviewcontroller

class detailvc: uiviewcontroller {  var brand: brand?  override func viewdidload() {     super.viewdidload()      self.setup() }  func setup() {     self.view.frame.origin.y = uiapplication.sharedapplication().statusbarframe.size.height      if let brand = self.brand {         self.title = brand.name     } } } 

this part needs change

override func tableview(tableview: uitableview, didselectrowatindexpath indexpath: nsindexpath) {     self.selectedcellframe = tableview.convertrect(tableview.cellforrowatindexpath(indexpath)!.frame, toview: tableview.superview)     self.selectedbrand = brandmanager.sharedinstance.brands[indexpath.row]      self.performseguewithidentifier(.detailvc , sender: nil) }  override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject?) {     switch segueidentifierforsegue(segue) {         case .detailvc:             let vc = segue.destinationviewcontroller as! detailvc                 vc.brand = self.selectedbrand              self.navigationcontroller?.delegate = self     } } 

override func tableview(tableview: uitableview, didselectrowatindexpath indexpath: nsindexpath) {         self.selectedcellframe = tableview.convertrect(tableview.cellforrowatindexpath(indexpath)!.frame, toview: tableview.superview)         self.selectedbrand =  brandmanager.sharedinstance.brands[indexpath.row]          let vc = storyboard?.instantiateviewcontrollerwithidentifier("detailvc") as! detailvc         vc.brand = self.selectedbrand         self.navigationcontroller?.pushviewcontroller(vc, animated: true)      }//// add storyboardid detailsvc "detailvc" 

Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -