I want to pop from viewContoller to parent viewController with out code - ios

I want to pop from childviewContoller to parentviewController in storyboard with out write any code in file with the help segue.
Thank You in Advance.

I would suggest having a button on your child view (potentially in a nav bar or anywhere else on the page). I your storyboard, control drag from the button on the child view, to the parent view. In the pop up, choose your action segue (standard slide in slide out would be the Show segue).
If you choose present modally as your segue, then you can change the Transition on the left to not animate. This give the segue a blunt but removal feel for the child segue.
Hope this helped

Related

How to keep NavigationController when performSegue from embeded tableviewcontroller

In the bottom left viewcontroller i have a searchbar at the top that call the tableview at the top , the problem is that i want to segue to the right viewcontroller with detail of it, but of course i'm losing my navigationController so when i'm into the right viewcontroller i can't go back anymore, how should i do to go back to my original Viewcontroller ?
Add Navigation Controller as the starting view in storyboard. And then Link RootViewController to it. This will ensure navigation bar in all the views coming next.
you may hide navigation bar in the view where not needed as
self.navigationController?.isNavigationBarHidden = true
push newViewController instead of presenting
Also please check, if you are presenting it modally. Modal segues take over the whole screen, so any navigation bars, tool bars, or tab bars that are in the presenting controller will be covered up. If you want a navigation bar on this modal controller, you'll need to add one specifically to it, and add any buttons you want to that new navigation bar (or tool bar). If you don't want to do this, then don't present it modally, do a push to it.

Inside a UITabBarController how do I segue from one view controller to another and retain the tab bar?

I drag a UITabBarController from Object library to the storyboard.
From firstViewController I want to swipe to another viewController named CustomController using a swipe gesture recognizer and retain the tab bar on CustomController when it is instantiated.
The problem is that once the segue is performed from firstViewController to CustomController, the tab bar no longer shows at the bottom of Custom Controller and it does not swipe back to firstViewController.
This is the outcome I would like to achieve. Please advise best route.
You can use ContainerView to view your view controller. when you
click on segment 1 you can set your firstviewcontroller to
containerview and when you click on segment 2 you need to replace customviewcontroller in containerview. you do like this you will not lose your tab bar viewcontroller. For Swipe gesture, you
can add it later if you want. Hope this can help you.

Swift - Remove View Controller from Navigation System

The best way that I can describe it is through and image, so i drew it out HERE. So, what happens is that in my table view, I press a button to add/edit information. When i am done, I press "Finish" at the bottom, which performs a simple segue back to the table view.
The Problem: Once back in the table view, the "back" button will now take me to the edit info page(which I just left) rather than the VC that came before it.
Is there any way to remove the Add/Edit info VC so that when I press "+" and "Finish" The back button will ignore the Add/Edit page?
Thank you for your help.
EDIT: . As you can see, when you press a button on the Table VC (lefT) it will take you to the right VC. Then, when you press finish at the bottom, it will perform a segue(no code, just a control-drag segue). The problem is still that the text message VC's back button will now direct back to the right VC, rather than the one preceding it (left)
I suppose you have a UITableView inside a UINavigationController since you have a back button, so:
User Tap Edit button: Push EditViewController in your UINavigationController
User Tap Finish from EditViewController: Save data, pop manually EditViewController and call reloadData of your UITableView
You would have to embed your complete sequence of view controllers in the navigation controller. This would maintain a stack of all the views that you would segue to. It will also give you a bcak button to go back to previous view. Alternatively, you can call the method popViewController() on navigation controller object to programmatically go to previous view. I hope that helps.

Linking Button to Next View Controller

I can't seem to figure out for xcode 6 how you would connect a button to go to the next view controller. In the view controller scene, I have 2 view controllers, VC1 and VC2. VC1 has a button and I want VC1 to be first, and then have the user click the button, which will lead it to VC2. How do I do that? Basically, how do I link the button in VC1 to VC2?
Just Press control key and drag your UIButton onto another view controller
Ctrl + drag from your button to the next controller in the storyboard. Choose "present modally".
Learn about UINavigationViewController, it's maybe more what you're looking for.

iOS 6: How do I segue from inside a tableview embedded in a nav controller TO another VC?

I have an initial 'parent menu' view controller with a 'photos' button (more buttons to come like 'events').
From the Photos button I have a simple ctrl-drag segue to a navigation controller which has a tableview as it's first view(albums), collections view(thumbs), then imageview(fullsize).
The problem I am having is:
I want to be able to segue back to the initial simple 'parent menu' view controller from the first table view after the nav controller.
I tried:
dragging a button into the table view's top menu bar area (it was considered a UINavigationItem) and dragging a segue back to the menu... didn't work.
setup outlet from button in the tableview menu area to its parent view and calling [self performSegueWithIdentifier: #"BackToMenu" sender: self]; from there, didn't work.
dragging a button into the table view as a last item and ctrl+dragging it as a segue to the menu: didn't work.
tried a segue going back from the nav controller to the menu and manually calling it, but the outlet function connected to the 'menu' button I dragged into the tableview top back NEVER gets hit.
What am I missing?
I plan to have a few navigation controllers going out from the menu page in the storyboard from multiple buttons.
You don't need a segue for this. You can create a button in your table view and link it to an action in your table view which dismisses the currently presented view controller (I'm assuming your segue that presented the navigation controller stack in the first place was of a "modal" type):
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
Alternatively, you can look into "Unwind Segues" but I haven't used these myself yet so wouldn't like to include details here.
You can drag a "Bar Button Item" to the left side of the first table view after the navigation controller. From there, do the control-drag back from the bar button item to the initial view controller, and choose a "modal" segue. While this answers your question, as #jrturton said in the comments below, this isn't optimized, because it will create a new instance.
If you want to do this programmatically (which will return to the existing instance), create an IBAction for the Bar Button Item on the table view controller. For example in iOS 6:
-(IBAction)returnToParentMenu:(id)sender {
[self dismissViewControllerAnimated:YES completion:nil];
}
or in iOS 5:
-(IBAction)returnToParentMenu:(id)sender {
[self dismissModalViewControllerAnimated:YES];
}
What I wound up doing was making the nav controller first before anything and then my menu page was first with buttons down each respective path.
on the above: The ctrl+drag didnt work from the nav bar button, kept totally blowing up.
I did not realize I could go from nav controller to a regular view controller first. thought it needed to go to table view first since when you drag out a nav it comes paired with a table.
If I had 10+ 'points' in this strange forum I'd post a screen shot of the storyboard.
Thanks all

Resources