mardi 4 août 2015

View is presented modally instead of Show

So I have a TableViewController. When a cell is tapped, a showEpisodes segue is called. This segue is set as Show and pointed to a Navigation Controller, like this:

Segue

The problem is that my view shows modally, i.e it doesn't have a navigationcontroller.

Here is the code I use in Main Table View Controller

    override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
    let cell = tableView.cellForRowAtIndexPath(indexPath)
    self.performSegueWithIdentifier("showEpisodes", sender: cell?.textLabel?.text)

}

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
    if segue.identifier == "showEpisodes" {
        let viewController = segue.destinationViewController as! UINavigationController
        let vc = viewController.topViewController as! EpisodesTableViewCOntroller
        let indexPath: NSIndexPath = self.tableView.indexPathForSelectedRow!
        let object: PFObject = self.objectAtIndexPath(indexPath)!
        vc.podcast = object
       // self.navigationController!.pushViewController(vc, animated: true)
    }

}

If I uncomment the self.navigationController!.pushViewController(vc, animated: true) part, the view will get pushed fine but as soon as it is loaded, a black window is modally presented over it. I've checked the UI Hierarchy in the debugger without success. Any ideas please?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire