Segue Trouble - Making New View Controller Fully Replace Old VC - swift

I have a 'main menu' view controller with links to different types of calculators. When I click on the link to a new calculator, the "main menu" can still be seen behind the new page. I would like to have the calculator completely replace the main menu when I click the link. I've tried modifying the segue on the storyboard, but cannot figure out how to fix this.
Storyboard settings
Purple outlines the main menu hiding behind the new view controller. I want this to go away.

You will need to embed the "Main Menu" into a Navigation Controller. If you don't do this, no matter what type of segue (which you refer to as a "link") you use, that outline will always be visible. To do this, select the Main Menu View controller from the storyboard, and click a little button on the bottom right of the screen looking like this:
and select "Navigation Controller".
Next, you can do one of the following:
Click on each segue from the main menu to each type of calculator, and in the attributes inspector, change the "Kind" (Which you currently have as "Present as Popover" to "Show".
Alternatively, if you like the way the segue slides up, and would just like it to be full screen,change the "Kind" setting to "Present Modally", and change the "Presentation" setting (under "Kind") to "Full Screen", for as many of the segues as you'd like.

Related

Call a segue from another Navigation Controller

I'm trying to jump to a View that's on another Navigation Controller.
You Can see the situation from my storyboard:
Once I get to the the "Edit Sticker" view i want to go back to the "Create Pack" but I don't want that the "back" that I get once i click save takes me back to "Edit Sticker", it should take me to the view that's on the left of "Create pack".
You can see the situation from this:
What could be a good solution?
How can I invoke a segue (the first one you see on the first picture on the top left, that's calling "Create pack") that's on another Navigation view controller?
UPDATE:
Tried setting it with one Navigation Controller:
and programmatically setting this when I press Add:
self.navigationController?.popToRootViewControllerAnimated(true)
takes me back to the "1st View". I need to go the "Create pack" view.
How come the Edit Sticker view controller is on its on navigation controller?
If the navigation hierarchy went Root -> Create Sticker -> Edit Sticker, you can call self.navigationController.popToRootViewController when the user clicks save.
But if you want to control the segue, then use self.navigationController.popViewControllerAnimated(animated: Bool) as that just pops the view on top to give you more control.

How can I add a button to the top of my TableView

I have the following in my storyboard and would like to add a button at the top of the TableView that allows me to add Members.
The scenario, a user is presented with the first screen which displays 'User Profile' and 'Members'. When 'Members' is touched the next screen is displayed that shows a list of Members and at the top is a button that says '< Settings' whcih allows the user to go back one screen.
I am trying to display a 'Add' button at the top when the list of Members is displayed.
Hope that makes sense!! I was hoping to not have to Embed the TableView in another Nav Controller.
Thanks for any help!!!!
You can add a button into the navigation bar, but first, you need to have a navigation bar.
To do this, you need to select your scene in the Storyboard and then go to the the Editor menu and select Embed In:Navigation Controller.
Once this is done, you can drag in a Navigation Item from the panel on the right.
Then you can add that to your class as an IBOutlet and declare an IBAction for it.
Cool?
Also, I think that your storyboard file might not be set up right.
Check out Apple's Simple Drill Down sample file available here:
http://developer.apple.com/library/ios/samplecode/SimpleDrillDown/Introduction/Intro.html
Cheers.

Is there an iOS sliding menu controller working like UITabBarController?

I found some iOS sliding menu controllers (like Path 2.0 , Facebook iOS), such as ViewDeck https://github.com/Inferis/ViewDeck, ECSlidingViewController https://github.com/edgecase/ECSlidingViewController. But they does not work like UITabbar Controler.
I want to make left side menu controller work like UITabbar, and it can kepp state for each controller for every mene item. It should not create a new controller when I tap a menu item. When I tap a menu item to display a controller (as "controller a") and scroll to someplace, then I switch to another menu item, and switch back to "controller a", it should show me 'controller a' display without changed, just like a tap a UITabbar item.
Thank you.
The below link might help you :
https://github.com/stefanoa/SASlideMenu
I use ViewDeck, but I do not have the problem you mentioned. The menu calls the main view to perform a transition, not to instantiate a new view. Therefore, I can implement a back option on the menu to return to the original view in the same state as it was left.
Here is my implementation. It's a subclass of a UINavigationController, and very easy to use.
https://github.com/aryaxt/iOS-Slide-Menu

Tab bar at top and bottom

I would like to develop a ipad apps which has a menu at the top of the screen as well as at the bottom.
There are four buttons on the top of the screen, and there are 10+ buttons at the bottom tab bar, which can be scrolled horizontally.
How can I write the root view controller as a framework for this operation?
Should I customize the UIViewController class or UITabBarViewController?
Thanks
EDIT:
Sorry for being unclear. Let me restate my question.
Actually my app will have the following hierarchy.
'Front Page' is simply a page (view controller) for user to choose language. After choosing the language, 'Menu Page' view controller is displayed.
Starting from Menu page and ALL view controllers (VC) in below, the page layout is something like this.
As you can see, there are top menu and bottom menu. Clicking on the buttons the app will quickly jump to the corresponding view controller (3rd level in the tree, VC1,VC2,VC3 etc) . And for every view, there is a BACK button on every page, clicking which will back to the parent view controller.
I was thinking to implement this by using a tab bar view controller and a navigation view controller but I still do not have a clear idea how to implement this.
Or maybe should I just use the navigation view controller and hide the top tool bar except the back button, and display an overlay UIView as menu which is on top of all other UIViews.
Can somebody help me? Thanks.
Since this is the outermost container for my app I hope to do it properly at start..
Sorry for my long question.
If you really want to develop a framework for this logic .You need to create Manager, ViewController, View, DAO ,Model and other classes according to your needs.
I assume you want to add the buttons dynamically to the tabbar (and if it scrollable , it must be a scrollview).You can use Toolbar for upper view but then it won't be in sync with the bottom-view(visually).In that case you will have to create your own customized views to look like a tabbar.
The manager will basically keep a track of all the buttons and different states of events and action on the views and the same information can be accessed via a static method form the viewcontroller.
Well you have not detailed on your needs , so it's difficult to predict the entire architecture.
You need a container view controller to manage selection of VC's 1-4.
clicking which will back to the parent view controller
Parent view controller is used to mean the container vc in a container view controller scheme - I'm not sure that's what you mean in this comment. Where exactly does the back button go?
See this link for more info about container VC's.
https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/CreatingCustomContainerViewControllers/CreatingCustomContainerViewControllers.html
You should be able to embed a tab bar controller in the content view of the container VC. Should be able to but it might be really buggy if there is a lot of communication between the child vc's.
The hard part is the back button. Basically it must be a button that goes back to VC 1-4 depending on which section you are in. The easiest way to do it is to make sure that when you cycle view controllers, pass the back button information as to which VC is the current child so it knows which VC to navigate to when you press it.

Won't add navigation item to navigation bar in xcode

I'm trying to create a back button on my navigation bar in x code. However when I drag it across from the objects library to the navigation bar in the storyboard it doesn't come up.
OK So this is crazy but...
Click on the navigation bar and in the attributes inspector, Just Type something in the field marked Back Button. Then in the scene hierarchy you'll see the button, though it won't yet appear on your navbar. In the hierarchy, drag the button onto the Navigation Item and viola it appears. Now to make second one, hold option and copy the first one. If you try to add one from the object browser, you'll lose the first one.
If done properly, the first will show up on the right and the second on the left.
Good luck.
This happens when the navigation is not set up correctly, as dbajkovic mentioned, if you do not have a navigationcontroller, it will not work. Your scoreboard should look like this:
You can not add the button to the left, only to the right.
#Jonathan Thompson: I came across your post and since I just learnt something new, I am going to add it as a response to your question.
There are two separate buttons - Back button and Bar Button. Back button has a reverse (right to left) pointing arrow and a Bar button is a regular rectangular button. The following describes how your could implement them in your program:
Back button:
On the root view controller, ctrl + click on button and drag it to the view controller you are trying to connect it to. When you are given an option to select from, choose Push, not modal. This will automatically add a back button on the next view controller. (Run the program to confirm it.)
Bar Button: (Credit: dbrajkovic)
For adding the bar button, click on navigation bar of the navigationViewController you are interested in. Under Attributes inspector, type some name in Back Button and hit enter to confirm. Open document outline and locate the viewController you were working on. On the left side of Navigation Item locate the disclosure triangle. Click on the Bar Button Item. Ctrl + click + drag the button to the navigation bar of that viewController. You can choose whether to place it on the left / right side.