Add view controller over tab bar based application with navigation controller? - iphone

I want to add a view controller over navigation view controller in a tab bar application which covers the full screen.
I have crated a view controller (enterPin) and added over the current navigationview controller in a tab bar application.
[self.view addSubview: enterPin.view];
but bottom bar, navigation controller and status bar is not hidding and comes over enterPin view controller. If we hide bottom bar, navigationcontroller and status bar it give white screen at back.
I want the view controller (enterPin) should appear over the navigationview controller (self.view).

Use modal view controller: Tutorial and documentation. Does exactly what you are asking for.

This is very normal behavior. 95% of the time the developer would not want the UINavigationBar to be covered by another view. You have a few options.
Use a modal view controller to prevent the user form interacting with other controls.
Animate the UINavigationBar out or disable it in some way.
Consider making the "Enter PIN" screen something the user sees when they first launch the application.

Related

Remove tab bar controller from view controller

I have a view controller which is connected my tab bar controller. This view controller also has a segue connection to a pop up view controller. As shown in the image below.
The problem is having is that the tab bar is being placed at the front of my pop up view controller like below.
I don't want this to be clickable since some weird behaviour happens when you press an item on the tab bar. So is there a way to send this to the back or hide this tab bar controller?
It's worth noting that in the class for this view controller there isn't an IBOutlet for this tab bar controller so i'm not able to access it in this view.
Removing a tab bar controller from a view controller where a pop-up or alert is only partially covering the background (or parent) view controller could be confusing or wierd looking to the user.
If you have access to your tab bar controller via an IBOutlet, you could disable touches to it by setting .userInteractionEnabled to false and setting the alpha of it to 0.7 or 0.6, giving an impression that it's temporarily disabled while the pop up is appearing.
If you don't have access to your tab bar controller (I just noticed that comment in the last sentences of your question), you could also register a notification observer in the class that does hold the tab bar controller outlet and you can send custom events (that you define) like "popupViewAppeared" and "popupViewDisappeared" to enable/disable the tab bar controller.

iOS - iPhone app consists of tab bars containing navigation bars.. overlaying a modal view makes area over tabset hard to hit

I have an iphone app consisting of a tabbar controller in the main.xib, where the tab bar controller contains navigation controllers, which are associated with corresponding view controllers. I assume this is pretty standard.
If I present a modal view controllers view from a navigation controller contained in this hierarchy, the view owned by this view controller pops up as you would expect. However, Ive noticed if I have controls (such as a button) at the very bottom of this 'modally presented' view it is rarely detecting taps. It seems as though the tabset underneath is blocking the touches. Note that when I present the modal view controllers view it fills the visible screen, it isn't sliding up from underneath the tab set.
I thought this tababar controller->navigation controller hierarchy was pretty standard, shouldn't I be able to present a modal view controller from a navigation controller in this set up without issue? I have also tried to present the modal view controller from the tab bar controller, with the same effect.
How do I present a modal view controller in an app with the tabbar controller->navigation controller hierarchy such that the lowest portion of that view can detect touches?
thanks for any help!
Check out the first answer by Harry, I believe this set-up is related to your situation. Post an update and let us know if this helps: UIView doesn't resize to full screen when hiding the nav bar & tab bar
Also, what code are you using to present the modal view?

Tab bar disappears after touching cell in tableview

I have an issue with a tab bar app. I am making a tab bar app with three bars on the bottom. On my my first bar it is a tableviewcontroller. When i ckick on the table view controller it takes me to a different view (which doesn't have the tab bar). When I clicked back to the home screen (which has the tab) the tab bar is gone.If you need a picture i will post it!
You may have set your UITableViewController segue to a modal style. If this is the case, you should change it to a push style.
In order for a push to work, your view controller needs to be in a UINavigationController. In your story board, select your root view controller and embed it into a Navigation Controller like this...

Change Selected Index of Tab Bar Application from Modal View Controller

I'm creating a tab bar application using the built-in tab bar app template in Xcode. I have 4 tabs, one of which is a mapView. For a few of the view controllers my code programmatically sets the selected index of the tab bar depending on the user actions. For the mapView view controller I have a method that presents a modal view when the user taps on a selected annotation. The modal view has some information about that selected annotation. I can dismiss the modal view controller and return to the mapView correctly.
My problem is that I would like to put a 'home' button on the modal view controller that should dismiss the modal view and take the user to 0 index on the tab bar (AKA home). The mapView is index 3.
I cannot do a [self.tab setSelectedIndex:0] from the modal view attached to the home button - it doesn't work. Perhaps I'm overthinking this. Can anyone offer a solution / hint? I greatly appreciate it! Thanks.
When you present a modal view controller from one of the tabs, the tab bar controller instance becomes the parentViewController of the modal view controller. You can use this property to call the tab bar controller methods.
[(UITabBarController *)self.parentViewController setSelectedIndex:0];

Partial Curl Modal Transition Style While Preserving Tool/Tab Bar

Is there a way to present a modal view controller that doesn't cover the tab bar of a UITabBarController?
Specifically I want to use the UIModalTransitionStylePartialCurl, but preserve the bottom bar, a la the iPhone maps app.
Have two view controllers
In the first have the second as a subview
Add your toolbar as a subview to the first and call bringSubviewToFront:
Present the modal in the second
UIModalTransitionStylePartialCurl
When the view controller is presented,
one corner of the current view curls
up to reveal the modal view
underneath. On dismissal, the curled
up page unfurls itself back on top of
the modal view. A modal view presented
using this transition is itself
prevented from presenting any
additional modal views.
And
hidesBottomBarWhenPushed A
Boolean value indicating whether the
bar at the bottom of the screen is
hidden when the view controller is
pushed on to a navigation controller.
#property(nonatomic) BOOL
hidesBottomBarWhenPushed
Discussion
If
YES, the bar at the bottom of the
screen is hidden; otherwise, NO. If
YES, the bottom bar remains hidden
until the view controller is popped
from the stack.
There are discussions around this topic on stackoverflow in the past