ios - PrepareForSegue is not being called when I did select a tableViewCell in SplitViewController's Master View -


i using tableviewcontroller master view of splitviewcontroller. looks right don't understand why prepareforsegue() not being called when click on row?
can force calling performseguewithidentifier() on tableview.didselectrowatindexpath.
guess should not need while using splitviewcontroller.

1 more thing, did not change in appdelegate.

could reason tableviewcontroller not being recognized masterview of splitviewcontroller?


here how tableviewcontroller looks like:

class masterviewcontroller: uitableviewcontroller {      var links = [sidebarlink]()      override func viewdidload() {         super.viewdidload()         self.links.append(sidebarlink(label: "home", url: "http://google.com"))         self.links.append(sidebarlink(label: "contact", url: "http://google.com"))     }      override func didreceivememorywarning() {         super.didreceivememorywarning()     }      // mark: - table view data source      override func numberofsectionsintableview(tableview: uitableview) -> int {         return 1     }      override func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int {         return 2     }       override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell {         let cell = tableview.dequeuereusablecellwithidentifier("item", forindexpath: indexpath)         let link = self.links[indexpath.row]         cell.textlabel?.text = link.label         return cell     }      override func tableview(tableview: uitableview,         diddeselectrowatindexpath indexpath: nsindexpath) {             tableview.deselectrowatindexpath(indexpath, animated: true)      }      // mark: - navigation      // in storyboard-based application, want little preparation before navigation     override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject?) {          if let indexpath = tableview.indexpathforselectedrow {             if indexpath == 0 && segue.identifier == "showhome" {                 let destination = segue.destinationviewcontroller as! homeviewcontroller                 destination.name.text = "home"             }             if indexpath == 1 && segue.identifier == "showcontact" {                 let destination = segue.destinationviewcontroller as! homeviewcontroller                 destination.name.text = "contact"             }          }      }   } 

when selecting row on master view controller of split view controller there no animated segue because detail view visible.

however, examining plain vanilla xcode template, notice there "showdetail" segue. 1 should called, , prepareforsegue.

make sure hooked correctly in storyboard. in storyboard, segue type should set "show detail (e.g. replace)".


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -