Going to first Screen of Navigation controller in iPad - ipad

I am stucked at a point in NavigationController..
I am in the third screen of navigation Controller. When I press Home placed on my third screen, I want to go to the first screen of my NavigationController.
Please, can anybody guide me how to do it?
Thanks alot

You can use popToRootViewController method of navigationController. Below is code snippet:
[self.navigationController popToRootViewControllerAnimated:YES];
Hope this solves your problem.

Related

ViewController pushing to next according to the specific notation

I need to push and pop the ViewController accordingly, but while pressing back button in my application, the ViewController should switch to next ViewController in backward. I. e. normally by pushing ViewController it slides from right to left, but while clicking back, the ViewController should come from left to right.
I normally use simple presenting and push ViewController codes. Please help me. I don't have navigation controller in my application for some pages and some pages have. Please provide me both solutions.
Though your question is not clear, I am assuming you want animation when transitioning back to previous view controller.
If you are not using navigation controller, just dismiss you controller like:
[self dismissViewControllerAnimated:YES completion:nil];
In case of navigation controller use this:
[self.navigationController popViewControllerAnimated:YES];

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.

Segue to navigation controller goes black

I am trying to create a segue from a button to a navigation controller that a master view controller is embedded in (I used the "Your Second iOS App" tutorial by Apple Developer). The problem was that whenever I clicked the button, I would get a totally black screen with just a navigation bar. There isn't any code involved. Would anyone happen to know how I could fix this? Any help would be appreciated. Thanks
Actually, I figured it out. It was because the split view controller was also pointing to the master view controller, so it had 2 segues pointing to it.

Close map from a button on a toolbar in iOS 6

I have an application where if I press a button I will go to maps, I was able to do that, and in my map view I have a toolbar which has a button "back" which is supposed to get me back to the previous view, however I'm having difficulties doing that because I can't seem to find an appropriate function to do it, or maybe I missed, Its my first time working with maps and multiple views for an iOS app. Can someone help me please with how to do it?
Thanks
You just want to dismiss the view controller.
If you're presenting the map modally, have the back button call a method that performs:
[self dismissViewControllerAnimated:YES completion:nil];

When redirecting back to home screen, buttons don't work and nav pane doesn't show

I have a login screen which redirects to home page after a successful login.
I redirect like this:
ViewController *viewController = [[UIStoryboard storyboardWithName:#"MainStoryboard_iPhone" bundle:nil] instantiateViewControllerWithIdentifier:#"main"];
[self presentModalViewController:viewController animated:YES];
and the redirection happens, and the home screen loads, but the buttons on it no longer respond to clicks, and the nav area is missing.
I am using push segues.
Would anyone know why this sort of thing happens? Also, right now I am using push segueys, but should I be using a modal seguey?
My functionality is: do some logic on one screen, go to the next screen.
First, I would create the entire "redirecting" differently. In IB, select the login view controller and drag from it to the home screen view controller and choose Push. Select the segue and add identifier and replace your redirect method with
[self performSegueWithIdentifier:#"identifier set in IB" sender:self];
You need to understand better how UINavigationControllers work. The reason the buttons arent working is that you have put them on the UINav controller itself and not on the "implied" toolbars that are associated with the view.
UINavigationController swaps out its controls with the controls of the pushed view. If you put controls directly on the UINav controller, your viewController will not get the associated messages.
UINavigationController is a container for views thats it. Go into IB and put your buttons on the toolbar of the views inherited toolbars and it will work.
This actually happend to me also. What happend was in my case, there was an option called Initial View in the Attributes Inspector. Keep it so that option is checked only for the UINavigation controller itself.
Try that. If it doesn't work, sorry :/
Edit: this is a question I posted a while back for bounty and it details this same problem. Check out the answer.
Are you sure that the View has it's userInteractionEnabled?
[self.view setUserInteractionEnabled:YES];

Resources