Change presenting viewcontroller - ios

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!

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.

Transition of a view controller embedded in a navigation controller

I have a problem with a transition. I am modifying this project https://github.com/xxxAIRINxxx/MusicPlayerTransition in order to have the transition from the right instead of the bottom. This part is fine. My transition comes from the right.
My problem is that I'm embedding the presented modal view controller into a Navigation Controller. I do this so I can use the "pushViewController" function when I click on a cell of my modal view controller.
My hierarchy is as follow. I have a dashboard. From the right, I drag a TableViewController X. If I drag back in the opposite direction, I come back to my dashboard. Fine. Now, If I tap a cell, it pushes a new ViewController Y.
Now, if I am in my new ViewController Y and that I drag back, I come back directly on my dashboard instead of going back to my TableViewController X, as a natural navigation controller should behave.
I did a small project on github that does only that, so you can easily see my entire code.
https://github.com/magohamote/NavigationControllerTransition.git
I understand why it behaves like this, but I would like to know how I can override the transition set on the navigation controller in order to have the normal behaviour of my navigation controller once it is presented.
Another problem I have not been able to solve. On the project I used as a starter (the one from xxxAIRINxxx) the transition is perfectly smooth. On mine, the first time I trigger the transition, it blinks and get stuck. Once I did it once, it is smooth the next time I drag my view. But the first time is always awful. I don't know why either :(
Thank you a lot for your help!

UIViewController, displayed modally, dismisses itself upon device rotation

I've got a UIViewController that I'm using as a login view that's displayed modally above a UISplitViewController. Once the user has successfully logged in, the modal view is dismissed. The master view controller in the split view controller has a left bar button item to logging out. Once the logout button is tapped the login view controller is displayed modally again. If the user rotates the devices at this time, the modal login view is being dismissed.
I have no idea how to catch this. When setting a breakpoint on viewWillDissappear on the login view controller only system API's are being called - nothing I wrote.
A sample app that reproduces the problem can be found here: http://d.pr/f/c6oG
Steps to Reproduce: Launch the attached app in portrait mode. Tap the login button. Tap the master button. Tap logout. Rotate the device left or right. The modal view dismisses.
Expected Results: Launch the attached app in portrait mode. Tap the login button. Tap the master button. Tap logout. Rotate the device left or right. The modal view doesn't dismiss.
Actual Results: The modal view dismisses upon device rotation after completing the steps to reproduce above.
I've also filled a radar bug #12585564.
Any ideas? Thanks in advance!
You need to present the login view controller from the split view controller, not the master or detail view controllers.
Although it's not exactly what I was looking for, I ended up overriding splitViewController:shouldHideViewController:inOrientation: in the DetailViewController. After that, the issue does not happen.
I do like the look of the master view controller staying on screen when the device rotates - similar to the Settings app.

Tabbar not showing in ios application

i am making one iOS tabbar application in that i have put 4 different tabs and whenever i click on 1 st tab and load another view after clicking of the first tab. After that when i press back button then tabbar is not displaying .So that i want hint that how can i show that
back the tabbar when we move from one tab from another and yes how i can use consistent the tabbar in whole application can you just guys help me on this i am new to iOS development.
here i am put the screen shot ...
here first screen is this one..
when i tap the video button that are first in the view then another window open
which are as under and see the tabbar is not there...
when in video controller there is tabbar is there but i drag and connect to that then tabbar is disabled
Looking at your screen snapshots, do I correctly assume you're attempting to transition to the "Videos" scene by touching the big "Videos" button in the center of the "Home" scene (rather than touching the tab bar button at the bottom of the screen, which I assume works fine)? If that's the case, you need to have your button tell the view controller's tab bar controller that you want to change the index of the tab bar, and it takes care of it for you. You cannot do the transition using a segue (or at least not without a custom segue, which is even more complicated than the procedure I outline below). If you're changing the view some other way (e.g. using a standard segue or using presentViewController, pushViewController programmatically, etc.), your tab bar can disappear on you.
You later said:
when in video controller there is tabbar is there but i drag and connect to that then tabbar is disabled
Yes, that's true. You cannot use a segue from one of your big buttons to one of the tabs in your tab bar. (Or technically, if you wanted to use a segue, it would be a custom segue which would do something very much like my below code, though perhaps a tad more complicated.) So, rather than using a segue for your big button, you need to write an IBAction (connected to the big Videos button on the Home scene), that tells the tab bar to change its selection:
- (IBAction)clickedVideosButton:(id)sender
{
[self.tabBarController setSelectedIndex:1];
}
A couple of comments:
My answer was predicated on the assumption that your tab bar works as expected when you tap on the buttons of the tab bar, itself. If you tap the buttons at the bottom of the screen, do you transition to your other views correctly and preserve the tab bar? If so, my answer above should solve your issues in getting the big buttons to work. If not, though, then the problem rests elsewhere and you need to show us your code that might account for that (either you're something non-standard in the UITabBarControllerDelegate methods, or your viewDidLoad of the view is doing something nonstandard).
If I understand your user interface design right, you have the tab bar at the bottom as well as the big buttons in the middle, which presumably do the same thing. That is, no offense, a curious user interface design (duplicative buttons, requiring extra tap on a button, etc.). You might want to choose to either use either big buttons (in which you can retire the tab bar, eliminate the IBAction code I've provided above, and just use a nice simple navigation controller and push segues, for example), or just use the tab bar (and lose the home screen, lose the big buttons, etc.).
You also made reference to "press back button", and I don't see any "back" button on any of your screen snapshots. Do I infer that you have a navigation controller and you're doing a pushViewController or push segue somewhere? If you're doing something with back buttons, you might need to clarify your question further.

iOS connect my view to popup on button press

I have two xibs, one is my title screen with buttons, the other is a more specific window that should come up when one of the buttons is pressed.
This isn't switching the whole screen, just a popup window, where clicking outside of the bounds of that window will make it disappear leaving only my title screen remaining as it was visible behind this popup view. This is similar to my understanding of "modal views".
Anyway I do not quite get how to connect it to the button on my title screen. I have the views made in IB ready to go. I'm not sure if I have declared all objects to satisfaction yet.
From what I understand I think I need a UIViewController or something, but its all a pretty thick fog of information right now
insight appreciated, or links to proper noob sources would be helpful
Does your title screen have a view controller (or is your app delegate the main controller object)? You will want to add an IBAction to that object, connect the button to it, and then present your other view controller modally (or in a popover) from there.
A popover will appear in a small window with an arrow, and tapping outside will close it. A modal view controller typically slides up into place, and you have to press a cancel button to close it. This guide explains how to use a popover. Using a modal view controller is simple if you have a view controller: [myViewController presentModalViewController:nextViewController animated:YES].

Resources