I have the following storyboard using SWRevealViewController.
The idea is I can navigate to a screen either from a homeVC which is a 'front' SWRevalVC or from the menuVC which is a 'rear' SWRevealVC.
When I get to 'MyAnotherVC' and tap on the back button, I want to always go to 'MYHomeVC'. However, if I have navigated there through 'MyMenyVC' there is currently no way to go to other view controller.
I guess this can easily be hacked in many ways, but I would like to know if there is a simple and efficient way of doing it.
Related
Im stuck with a problem me and a friend of mine are building a app in ios. see video.
please watch this video:
https://youtu.be/SHrBF6h8Nso
The problem is when we are done with the workout and we get to the finish workout screen and we click on the profile button it goes to the workoutOverview Screen. But we want it to go to the profileOverview screen.
We try to achieve this with this line of code :
self.tabBarController?.selectedIndex = 1. // this results in segue to workoutOverview instead of profileOverview, no matter what index we use
But finish workoutOverview is not part of tabbar controller or the navigation controller that we have.
the second problem
When pressing the cancel button (cross) we would like to pop to the first viewcontroller (muscleList) but without losing the tabbar!
see how our storyboard is connected in the picture:
Question:
How to go back to profile view controller in the tabbar controller?
How to show view controller with tabbar controller when click on the cancel button?
If anyone have a idea it would help us a lot.
xCode has a bug with the show segues. Change all "Show" segues to the deprecated "Push" segues and build and compile. Than change all back to "Show" again, build, compile and it works now! All viewcontrollers will be added to the stack.
I follow this basic tutorial to start playing with JSQMessagesViewController:
https://www.raywenderlich.com/122148/firebase-tutorial-real-time-chat
How can I do to have a back button in the ChatViewController?
When debugging it seems to be here but maybe masked by something.
Thank you for any feedback.
Regards
Your problem is that the "ChitChat" scene is the root ViewController; there's nothing to go back to!
Even though the Log-In screen appears before the ChiChat VC, you can see how it segues TO the Navigation Controller, which is Embedded in the ChitChat VC.
Think of it like this:
Since the Log-In VC appears before the Navigation Controller, it never sees it, and doesn't know that there's a screen to go back to (this is simplified logic).
If you want to have a back button to go back to the Log-In VC, then try playing around with embedding the Navigation Controller in the Log-In VC (By using the editor tab, and then selecting "Embed in" in xCode, if you've never done this before)
Heyo,
Right now I've got an app that presents a menu screen that partially covers the original screen, and can be used to navigate to other screens. This is done using a modal segue.
To get to another screen the from the base page the menu is presented, the user selects the next screen in the menu, the menu is dismissed, and THEN the segue to the next screen is preformed.
What I've spent a few weeks trying to figure out, however, is how to dismiss this menu DIRECTLY to a viewcontroller OTHER than the one that's presenting it.
I'm thinking I've got to figure out how to change a presenting view, but I haven't had any luck.
Currently I'm completely at a loss, and any recommendations/fixes would be great!
I am developing an iOS app that I have already developed for Android.
The problem is I don't know how to organize my UIViewControllers considering the following scheme of my app pages:
The scheme is simple: there is a login page which leads to the main page. From this main page, there are four buttons which all lead to a specific view hierarchy but at the very bottom of each, the user will be able to go back directly to the main page. Each page accessed by the main page will also have a custom back button (an image of my own)
The question is: is there any benefit in using a UINavigationController (obviously with the main page as its root) in my case? Or can I simply create each Controller and using only Modal Segues?
If your view controllers have a navigation relationship so using UINavigationController is the way to go:
In 'push' segue, you are basically pushing your ViewController into an
already setup "navigation stack". Well, of course, this is under the
assumption that the ViewController that performs the 'pushing'
operation belongs to the same navigation stack as the ViewController
is pushed into. Generally, you push a ViewController if the pushed
ViewController has some sort of a relationship with the pushing
ViewController. This is very common in applications that has a
NavigationController in its system. A good example for a push segue is
a system where you are displaying a list of contacts. And on tap of a
particular contact, you are pushing a VC that has the corresponding
details of the contact.
Example is real world: list of products => product details => product reviews
If you want to temporary present a view controller and the main focus is your view controller but you need to present another view controller to perform a task like "filter" , "login", adjust "settings" then modal segue is the way to go
In 'modal' segue, there is no stack as such. You are presenting a VC
'modally' over the presentee VC, if that makes sense. This can happen
across any ViewController without any relationship rules. The
presenter should take care of dismissing the VC it presented. A good
example for modal segue is login. On tap of login, you are modally
presenting a VC that has no relationship with the presenter.
If your view controllers are not related to each other, but each view controller has his own navigation stack then UITabBarController is the way to go
Storyboards (Xcode): What is the difference between a push and modal segue?
I would say if each of the additional view controllers from the main "home" view controller don't have any children view controllers, then you can just have each button present a view controller modally.
The main difference is if you are using a navigation controller, you can "pushing" a vc onto the navigation stack of view controllers, whereas presenting it modally can be thought of a "one time" action where the user does something on the new screen and has no where to advance to logically (like adding information to a new contact).
You can see this post for a more detailed answer:
What is the difference between Modal and Push segue in Storyboards?
Deciding whether to use a Modal segue vs a Show (push) depends entirely on purpose and context of the user's experience. If you are leading the user down a path which is linear, where each successive VC is diving deeper in to a singular idea, then use Show segues and NavigationControllers. Examples include, Settings app, where you can drill into all the specifics. Most e-commerce app will use a NavigationController to lead the user through a purchase.
If you want to present the user with a single concept, which the user can respond to, or close it to continue using the rest of the app. Then use a modal presentation. Adding a contact in the iPhone is a fine example of this.
Visually, the difference is that a Show segue presents the VC from the right side of the app, sliding onto the previous VC. (If the user has Arabic language turned on, a right to left language, the Show segue will come from the left hand side of the VC) A modal comes from the bottom of the app.
From looking at your drawing, but not know anything else about your app, I think you want to use NavigationControllers. You may also want to consider a TabBarController. If each of these buttons lead the user on various ways of using the app, like mini apps within one big one, then a TabBarController is appropriate.
I have a 'details' scene that can be navigated to by a drill down search. But I also have a qr reader that when it reads a QR code, should take the user to the same details page. Now, that all works fine. My only issue, is when the I use the scanner, I am not presented with the Navigation Controller to take my self back to the scanner. I am presented with a Back button for the drill down from the table.
What is the best method for giving me a navigation controller that will pop me back to the correct original calling view?
So the answer for those wondering, is WAY similar than I thought. In my example, I simply embedded my Scan scene in a Navigation Controller.