I am having a minor problem with segue using push in Xcode's storyboards. Its pretty straightforward: even with the simplest case, I can't manage to get it working.
The setup: http://d.pr/i/ahCG
Which is basically just a 1-view project, added another view controller, embedded that into a navigation controller and made the segue and setting the mode to "push". There is absolutely nothing happening when I push the test button. If I make the segue with modal however, it works fine.
What am I doing wrong?
You need to embed the source view (not the destination view) into a nav controller to do a push segue.
You need to set the mode to "modal" instead of "push".
Related
I'm currently developing a framework in Swift that includes a storyboard that I designed myself. What I need to do is that the user that uses my framework can create a segue to my storyboard. Then I'd like to be able to recreate a segue to the user storyboard that that I "leave" my storyboard.
How could I do so ?
Thx !
Your question is vague and I am not entirely sure what you are asking. However, I can't comment yet so I will try to answer with what little I know. It seems like you are asking how to transition storyboards. The simplest way is using a UIButton in your storyboard. Open up storyboard and go to the navigation controller. Then, add a button to the Nav Controller. Right click (or control click, depending on your settings), and drag the line to the main storyboard. Lastly, click on the show option. When a user clicks on the button, it will immediately switch to the main view controller. Don't forget to add the button in the view controller. Hopefully, this is what you meant and helps. If you wish switch view controllers in code, this is a duplicate and you should go here: How to switch view controllers in swift?. If this doesn't answer your question, comment and I will try and help. For future reference, please provide more information: snippets of code, pictures, anything that better demonstrates your problem.
I fixed it by getting the instance of a new view controller added on the user storyboard with the view controller identifier like so :
ProcessOut.backViewController = storyboard?.instantiateViewControllerWithIdentifier("back")
And then I present it like I would present a normal viewController from my storyboard.
I am currently learning iOS development and I began with a simple Tabbed Application. It has the default First and Second View in it. I added a TableView with static cells content. I then added another View Controller. I created a Segue using the storyboard. When I set the transition to modal, it works fine. When I set it to push, the app is crashing (Uncaught exception).
Any idea why?
How can I get more information regarding the exception? Can I make the app stops when it encounters an exception?
Figured it out.. I need to add a Navigation Controller to use push...
I've created a table view which is embeded in a Navigation Controller as such and connects to another view controller. I've the connection from the table to the navigation controller as a modal segue and the segue from the table bar to the View Controller as a push segue yet I am still getting the error:
Unsupported Configuration
Scene is unreachable due to lack of entry points and does not have an identifier
for runtime access via -instantiateViewControllerWithIdentifier:
This worked last week and now its not. Ive tried adding storyboard IDs but thats not working. I appreciate any help.
Did you check your start point in your storyboard? In other words, on the left side of your starting navigation controller, do you have the arrow pointing to it? If not, drag it until you make it point to the navigation controller.
Also, if you're doing that dynamically, have you provided your UIViewController/UITableViewController/UINavigationController Storyboard IDs? Please, double check that by clicking on your view controller in your storyboard, then in the Inspector (right side of Xcode window), go to the third tab and make sure you have set the ID and make sure they are consistent with your code.
I'm trying to develop an iPhone app that uses 4 views(View-based app), and I want to navigate from one view to the other. It would be ideal if for example the Submit ID button automatically sent a message to UIViewController to switch to View 2, and selecting a cell in View 2 would load View 3.
See a screenshot of the Storyboard here.
I'm not sure how to do that, so I've tried using a separate button to switch between views, but that isn't working either and I can't figure out why.
You can have a look at the source code which I've uploaded to Dropbox.
First, I would suggest posting your code in your question. As appreciative as I'm sure other people are that you provided a dropbox link to the code, most people presumably have little interest in downloading the file to their computer, unzipping, and launching the project (me being one of them).
That being said, let's make sure you're clear on Storyboards and the general view controller hierarchy principles. You have, in your storyboard, four UIViewControllers dragged out into your workspace. So, you're not switching the views of a single UIViewController, telling it to switch from View1 to View2 to View3 and so on. You need to be telling the view controller hierarchy (which, in your case, probably needs to be managed by a UINavigationController), to push and/or pop view controller on and off its stack. It appears that you have some segues set up between your view controllers. Are you calling performSegueWithIdentifier:sender: in your code? Alternatively, you could hook up the Submit ID button to perform a push segue to View Controller 2 in much the same manner.
Once you have that working, you can override prepareForSegue:sender: to send information from ViewController1 to ViewController2 and so on.
I have an application containing a variety of view controllers linked together in different ways (Welcome > Browse > Preview OR Browse > Preview OR Settings > Splash). The first view controller is presented modally using a navigation controller from a main controller, then the next set of view controllers are added using pop and push.
This works correctly, but I need to be able to define my 'UINavigationBar' and 'UIToolbar' within interface builder, so they still work as expected if they are presented without using a navigation controller. Is this possible? Currently I get this if I try:
alt text http://xs.to/image-CD8B_4B9E739D.jpg
Do it in code.
In the SDK it appears you're using, it is fairly trivial to test whether you need to push onto a nav controller or not, and if you are hide the toolbar and adjust the view size to account for that (a custom init method for the view controller will help with this, and if you're particularly smart with how you do things you could even declare a category on UIViewController)