In my weightlifting app, I have a view controller that I want to use for a couple of different purposes. One is to select a lift type that will be saved as the user's default. The other is to select a lift type that will be used to filter a log of the user's lifts by lift type.
One of the paths (choosing a default) starts at a Settings screen. When you tap the UITableViewCell to go to the Select a Lift screen, the view slides in from right to left as expected, however, it immediately slides the view in again from right to left and the navigation bar points back to, well, itself:
Here's my storyboard layout:
Here's the relevant segue code:
// MARK: - Segues
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "goToLifts" {
let vc = segue.destinationViewController as! LiftSelectionTableViewController
vc.delegate = self
} else {
return
}
}
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath:NSIndexPath) {
switch indexPath.row {
case 0: performSegueWithIdentifier("goToFormulas", sender: self)
break
case 1: performSegueWithIdentifier("goToLifts", sender: self)
break
default:
break
}
}
I'm using Swift 2.3 and Xcode 8.
I've read Apple's documentation and found several topics on SO that involve multiple vc's going to one vc but they're either dealing with passing data problems or other things.
Can anybody tell me why this is happening and how to fix it?
UPDATE:
Made the change suggested by @vacaWama and now it appears from the bottom and with no navigation bar:
UPDATE 2:
.storyboard source code exceeded the limit so here's a link to it on GitHub:



performSegueWithIdentifier. If you want to call the segue programmatically, wire it from the viewController icon at the top of your tableViewController. - vacawamasettings->Liftsscreen to the 'select lift type' screen? Does the 'Lifts' cell gets highlighted when you click on segue in the storyboard? And I second what @vacawama said. - Bista