NavigationController in swift leads to a black screen - ios

I'm trying to use a navigation controller for an identification process in my swift code but each time I click on a button that leads to it, it shows the following black screen:
Here is my storyboard if this can helps, there is no warning and no error in the code (using a drag and drop segue or a programmatically one leads to the same black screen)

Probably the segue you picked: mode & transition.
Are you certain you only have a single segue? It is possible to have overlapping segues, which do not show up clearly in Interface Builder.
Edit
Is there a way we can see all our segues?
Open the Storyboard in its new window
Show Document Outline (leftmost pane)
Show Attribute Inspector (rightmost pane)
Select each View Controller Scene in the Document Outline. The Segues are listed at the bottom. You can inspect Identifier and Segue in the Attribute Inspector.

Sounds, I was doing the wrong way (drag a nav controller, delete the table view, add a new View controller and make the segue), but now if I create a view, and then I embed it in a navigation controller it sounds it works ! Anyway, thanks a lot for your help, this definitely helps me !

I got this when I assigned a custom view to self.view in viewDidLoad:.
self.view = self.mapView
Adding mapView as a subview of self.view solved this.

[I see you've created a custom ViewController, are you sure it's a subclass of ViewController?
You can see which subclass is it off after the ":" in the class declaration!

Related

Swift: Storyboard solution to clicking from ViewControllers to ViewController in a ContainerView

I am building a App with a fixed Top Bar and some fixed Buttons at the bottom. In the middle of my MainViewController I want to have some Tables I switch in between. The ways I want to do it:
clicking the buttons at the bottom
clicking buttons in my tables
To solve the problem I put a ContainerView inside my MainViewController. It works for me already to switch the InsideViewControllers by clicking one of the buttons at the bottom. I solved it with Apples Tutorial programmatically. By click on a button I change The childViewController of my ContainerView.
When clicking a button in my InsideViewController I am sending a message to my ParentViewController (the Container) right now. This I did by implementing a protocol and checking if my parentViewController implements it.
Now my question is if this is the optimal solution to click from ViewController to ViewController inside my ContainerView. Or is there a better way to click a button on my Table and get the next Table?
What I was thinking about is maybe possible:
A storyboard solution. I want to connect ViewControllers inside my storyboard. So that I have a button on my first view Controller and do a segue from this one to the next ViewController. If I do it just like explained the new ViewController is not filling the Container. There pops up a normal ViewController to my app. Here a example View of this idea:
Is it possible or do I continue by sending messages to my parent?
Sure you can. You can start reading Implementing a Container View Controller, specifically, the section "Configuring a Container in Interface Builder". At the initial phase of adding the Container View, you will automatically see a new UIViewController appearing there. I guess if you will want to perform transitions, you will have to Embed In a navigation controller that new view controller.

How to pass from one Containerview to Another UIViewController

I'm in trouble with passing from one containerview to another UIViewController
This image below demonstrates a storyboard for what i want to do.
My app has one Containerview and I added button in this app. When I hit the button I want to pass another view via segue. But when I hit to button view is being opened on full screen. I just want to open this view, same size of containerview. Which segue can be useful for this trip? How canit be done?
If you change the viewcontroller that is embedded to a UINavigationController and then make the original embedded viewcontroller the rootviewcontroller of the navigation, then you should get the desired behavior.
set fixed size in attribute Inspector what you want then it will show only that size view

Adding toolbar to a ViewController in storyboard

I'm using storyboard to create an iPad app. On the main view I have a toolbar and a bar button item, let's call it "show". Then I have dragged a table view controller into the storyboard. I have also added a subclass of UITableViewController to the files and made the class of the dragged table view controller to be that subclass. And I made a popover segue from the "show" button to the table view controller. It works fine, meaning that when "show" pressed I see the popover showing the correct data that I set in the table view. What I cannot seem to figure out is how to put a toolbar on top of the table view in the popover. I took a step back and used a UIViewController instead of UITableViewController and still cannot add a toolbar by dragging it to the view. Any help will be appreciated.
I ended up putting the TableViewController within a NavigationController and the latter in a PopoverController, all in the code, without using IB. I found this an easier solution to get the toolbar than anything else that might work.

How can I change the Storyboard animation for modal in Xcode 4.2?

I am quite new to Xcode coding and I have been using Storyboard for along time, if you know when you link a button to a view and select the option "Modal" it will make a link with the animation of the new view coming up from the bottom. I was wondering if it was possible to change the animation to the new view coming from the right. I am sorry this question was so brief, if you need more info just ask me.
Thanks.
If you select the segue and look at the Attributes Inspector (on the right side of the window), you will see a pop-up menu labeled Transition. This menu lists the available transition styles for the segue:
Cover Vertical
Flip Horizontal
Cross Dissolve
Partial Curl
If you want a different style of transition, you will need to use a different type of segue. If you have a UINavigationController hosting your source view controller (the one that contains the button), you can use a Push segue, which slides the new view in from the right. If you don't have a navigation controller or don't like the Push segue animation, you'll have to implement a custom segue to change the animation.
More on custom segues
Custom Segue- Apple
Custom Segue + CATransition
-anoop

Adding a toolbar to a navigation controller

I am completely new to ios development and I am only interested in developing for ios5.
I have an app with some scenes, they are mostly tableviews. I also use a navigation controller
I however need to add some status text and buttons that are always visible in all scenes and thought that a toolbar added to the navigation controller should do the trick.
so i thought that i should only have to drag out a toolbar in storyboard to the navigation controller, but it does not stick there. I can add it to the bar underneath with first responder and navigation controller but that does not help me (small icons).
I can also not add it to my table view (but if i drag out a plain view I can add it there)
do I have to make my own custom navigation class that the navigate view uses and then programatically add my toolbar?
Had the same question recently. Check Attributes Inspector in your ViewController's properties in storyboard. There you can define a Bottom Bar.
Well, inside the UINavigationController, you should have something... A UIViewController for instance. You can easily add a UIToolBar by dragging the object inside the UIView of the UIViewController. What might being happening is that as the root view you have the UITableView, in that case I think you can't do that. But to better understand, just take a small print screen of your StoryBoard.
If you zoom up to 100% on the storyboard it should drag.

Resources