JSQMessagesViewController back button not visible - ios

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)

Related

How to go to tabbar item from an external view controller

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.

ios SWRevealViewController pop from rear to front

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.

iOS complex navigation between view controllers

I have a complex flow between view controllers (vc). When my main view controller shows, it checks if a user is logged in, and if not, it pushes a log in vc in viewWillAppear. The login then can the push a register vc. Further, on app's very first start, it also shows a special vc, also from the main vc's viewWillAppear (just once). It does not matter if the user has logged in or skipped the log in.
The app can be opened also by custom URLs, which should open one of my vcs. The app must start/resume at that screen without any visble transition between vcs. All this flow is handled from my main vc, which handles this in viewWillAppear and in didBecomeActive which is an observer for app's UIApplicationDidBecomeActiveNotification. Some of those custom URLs must open the login screen first.
My naive approach was to handle all this logic in my main vc's viewWillAppear where I pushed vcs base on the current state. This works for pushing the login screen on app's start without any problem. The problem is that when I return from the login and I need to push another vc. The main navigation controller knows that something was pushed (the back button becomes visible) but the old vc is visible (the main), with partially broken views, and does not react to touch events. Tapping the back button makes a complete mess from my app.
I googled and the problem seems to be that we cannot push a vc while another one is popping. I have found a BufferedNavigationController, which solves this, but it does not work correctly under iOS7 yet. I do not even see any logs in device's console.
Another issues is that while the app is in the background a memory warning could mess my vc's and the app has completely different startup than a normal resume from the background.
At the moment I came with a quick hack where I create a custom backstack for all the situations and set it as the navigation controller's back stack and push the last vc on top of that stack. Then in the login/register screens I modify the backstack if a user skipped the login/register process. This is an ugly hack an not a very future proof solution. I would like to centrally controll the pushing of vcs in one place and there cannot be any visible transition between them in that situation.
Is there any better/more robust solution to achieve this? I cannot have visible transition when returning back from one vc (this is animated) and the vc beneath it should push another on top of it while it becomes visible (no animation of this push). So it looks like we return to a completely different screen? No matter if it can be confusing for users, that is for another question.
EDIT 1: I am targeting iOS7 and newer only.
EDIT 2: Here is a sample demo which shows my issue. I directed the link to he main vc, which pushes other vcs in its viewWillAppear (the other vcs are not important). It is just for presentaion purposes.
This demo shows logs into console "nested push animation can result in corrupted navigation bar" and "Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted." which do not show up in my big project. I know what they mean, but how can I push a vc when antoher is popping away? The mentioned BufferedNavigationController does not work for me on iOS 7 (and it is not a problem, that it does not use ARC).
EDIT 3: When I start the provided demo for the first time, it will open the login screen instead of the main - good. Then after tapping the login it goes back to the main screen and should instantly push the another screen without the main being visible. It does not do that, the main is visible but the navbar thinks there is something above the main, thus the visible back button. It corrupts the backstack...
https://stackoverflow.com/a/20947860/1405008
Refer this for your first scenario like open login or other view controller.
For custom URL u can also use the same logic and check and present when its arrive from custom URL.
Always set the root view Controller will the easiest way to do this kind of different navigation stuffs in Your application also this approach avoid unwanted view-controller in stack.

Switching between views in iOS app

I have a slide out menu in my app and each of the things in the menu goes to the respective pages.
Basically, when I tap "graph section" on the dashboard, I want it to go to the graph page without the Dashboard back button.
I've tried doing this with a modal segue but this provides a back button which means I can't access the menu on this page.
Anyone know how to do this?
I am not quite sure whether this answers it but have a look at:
Open View Controller programmatically and not using a Seque
I think you Use navigation controller.Once you hide the navigation controller for that particular page with [self.navigationController setNavigationBarHidden:YES]; and add UIButton and write it's action

UITabBar comes to uinavigation controller

I have a logout button in a viewcontroller that I have a tabbarmenu, when I press logout I can logout but my tabbarMenu is come to my navigation View controller,
would you please help me to fixed this problem, Thanks in advance,
I think you mean that you are in a tab bar controller, and when you log out you want to navigate to your loginViewController. This is happening, but your tab bars are still visible, and you want your tab bars to disappear as you have logged out.
The reason that the tab bars are still visible is because you are not navigating away from your tabBarController. You are navigating inside one of the tabs to a new loginController.
If my interpretation of your question is roughly correct, you will find the answer here:
How to handle UINavigationControllers and UITabBarControllers iOS 6.1
It shows how to deal with a loginscreen -> tab bar controller, with a logout button on each screen which will properly return you to your loginscreen (note - it doesn't create a new login screen, as you are doing here, it more correctly navigates you back to the original login screen).

Resources