Reputation: 10560
I'm just following a YouTube tutorial Swift iOS Tutorial - Core Data - Add Update Delete PART1 (Xcode 6 Beta) that was done in different Xcode version and encountering navigation issues that wasn't apparent in the tutorial. I suppose this is something to do with changes in latest Xcode that I hope some one might be able to address here.
I have one TableViewController with embeded in NavigationController (initial view) and from the TableViewController, I made a push segue from +
bar item to another ViewController. In simulation mode, this +
button displays as Edit
and clicking this doesn't go to the ViewController it should push to.
This is how it's done in storyboard.
And, this is the simulation screen that the button is wrong and clicking this doesn't go to the next screen.
**UPDATED
Upvotes: 1
Views: 446
Reputation: 5765
This is why I don't like storyboards. I suggest doing it programatically.
Here's how you could do it in your viewDidLoad
function:
var navPlusButton = UIBarButtonItem()
navPlusButton = UIBarButtonItem(title: "+", style: UIBarButtonItemStyle.Plain, target: self, action: "myAddFunction")
self.navigationItem.rightBarButtonItem = navPlusButton
Then you'll just make a function outside your viewDidLoad called myAddFunction
or whatever you call yours.
func myAddFunction() {
var VC = addVC()
self.navigationController?.pushViewController(VC, animated: true)
}
You would probably replace the above with a segue instead of a pushViewController, if you are using storyboards. :)
Upvotes: 1
Reputation: 81
check the segue connection, if you have given it to cell, if there is a record then only it navigate to the next view. other wise give a segue connection to the edit button to next view for testing purpose.
Upvotes: 1