UIBarButtonItems in UINavigationBar are sticking to the borders - ios

I'm getting a weird bug since using PageMenu library. This library adds the ability to swipe between view controllers or change current view controller via UISegmentedControl (on the top).
When the view controller is a UINavigationController, all UIBarButtonItems in the navigation bar are sticking to the borders, like this :
The two items are sticking to the borders of the screen. The same thing happens with Back button after pushing to a view controller.
The bug disappear if I present a view controller modally in the app.
Does anybody has a solution for this ? Or at least a workaround to simulate "presenting a view controller modally" at app launch ?

Related

Toolbar disappears after segue - Swift

When using a segue from a slide out menu to other view controllers, my toolbar and navigation bar both disappear. I fixed the navigation bar disappearing by segueing to a navigation controller, which then set the desired view controller as the root of the navigation controller. However this does not fix the toolbar issue. Should this not have fixed the toolbar disappearing as well? Either way, what is the best solution to my issue?
Thanks!
I have had this problem using SWRevealViewControllerLibrary. In your storyboard make sure you are using "Reveal View Controller Push Controller" segue. If you have multiple segues, when you click on them you may find some things like the toolbar disappearing from the storyboard. If so then simply make a new one in the storyboard.
As for the second part of the question, from what I can tell toolbars are not by default part of a navigation controller's 'root' view, and so may change across controllers - just like how if you created a button or label in your first view, they would also change.

The back button in a navigation bar is shown in ios7/ios8 but not in ios9

The device runs ios8 and the back button is properly shown and I can use a swipe gesture on the device to navigate the view stack.
On the simulator (running ios9), the back button will not appear, and the swipe gesture does not work.
UPDATE: I have updated the device to use ios9, the back button vanished.
I have now found the source for this.
In the storyboard, the navigation controllers were cascaded.
The segue of the first controller stacked another full view controller, not just the view. On that view controller, the navigation was not properly initialized.
On ios7/ios8, this made no difference, the root-navigation controller's navigation bar was used. In ios9, it seems, that the navigation bar of the initial navigation controller is overwritten or it requires specific segues to the parent navigation view.
If the swipe feature is also dependent on the missing navigation bar initialisation, I have not tested. I have removed the superfluous navigation controllers and directed the segues directly to the views and now it works.

Using iOS 6 autolayout, what would be the proper way to display somthing above an UINavigationController?

In my app, i have a main view controller which sometimes brings a modal view on top of it. This modal view is a UINavigationController with a navigation bar. I want to display an image above the navigation bar, and have the navigation bar appear below the image.
I do not want to subclass anything and the app uses autolayout, i do not want a bunch of delegate callbacks and frame calculations. The view inside the navigation controller (the actual modal content) must still respond to different screen sizes correctly, such as rotation, call status bar etc. Also, no IB solutions please, these views are all managed in code.
How do i accomplish this?
I would turn off AutoLayout and place the image at the top
I don't think you can do it with your modal view being a navigation controller. I would do it by making that modal controller a UIViewController that you set up as a custom container controller. You can add an image view to the top of this controller's view and add the view of a child view controller (which would be a navigation controller) to the bottom. This would be a lot easier to do in a storyboard using container views, but it certainly can be done in code.

Slide viewController in navigation controller

I'd like to use a slide up / down effect to display various viewControllers inside a navigation controller. A few other apps do this like square, and every day. Basically when the app loads, I want to display a base view in the navigation controller. Then slide up another view controller over top of it. When then hit a button in the nav bar, I want to slide that down and show the base controller, all the while retaining the navigation bar, and changing up nav items.
Originally I tried to make this work by showing a modal but that requires using a new nav bar.
Has anyone done this, or knows of a good example that illustrates this UI pattern? Thank you!
You could have UIViews in a UIScrollView

Hidden UINavigationController inside UITabBarController

I have an application with 5 UIViewControllers each inside a corresponding UINavigationController, all tucked inside a UITabBarController that displays 5 tabs at the bottom of the screen.
I want to display another UIViewController (inside a UINavigationController) when a dialog button is pressed.
This view should only be loaded and unloaded programatically; i.e. it should not appear in the tab bar. However, I want the tab bar to be visible always.
If I add the [UINavigationController view] to [self window] the UITabBar is covered. If I add it to any other layer, the UINavigationController adds on the compensation it has for the status bar so appears further down than expected.
A solution would be to have the 6th UINavigationController added to the UITabBar with the others, but with its tabBarItem hidden. Then I can show it and hide it using the tabBars selectedIndex property.
Accessing the tabBarItem through the UIViewController shows no obvious way of doing this.
#wisequark, I think you completely misunderstood and you have almost rewritten the architecture of my application. However I have a separate navigation controller for each view as they are mutually exclusive and there is no concept of "drilling down".
#Kendall, This is what I expect I will have to do - have the modal view appear with a hide button to bring back the normal interface. But it would be nice to keep the tab bar always visible, so I was just wondering if anyone knew of a way.
It sounds as though you have a mess on your hands. A UINavigationController is a distinct object that is very different from a UITabBarController. In general, your application should have a tab controller, one of who's tab's loads a UINavigationController which in turn loads it's views - not that both maintain management over the different views. It is also improper to refer to the display of a UIViewController as such an object doesn't have a visual representation. In the case of a UINavigationController, the navigation controller object is responsible for displaying a navigation bar and a table view (in the most common case) and for managing the display of all the views in the navigation hierarchy. It itself has no corresponding representation on screen. Similarly, a UITabBarController presents a tab bar and is responsible for the loading and unloading of the views and/or view controllers attached to the tab buttons. If we were to present this as an image, it would look something like this -
alt text http://img.skitch.com/20081112-2sqp7q4wafa34te1ga337u4k8.png
Well, it sounds like what you really want to do is present a modal view with the tab bar still visible. You could add your view as a subview of the tab bar controller's view. The tab bar's view is, oddly enough, not the tab bar itself but rather a view containing the tab bar and the selected item's view.
Alternatively, you could try calling presentModalViewController:animated: with the selected tab (i.e. [tabBarController.selectedViewController presentModalViewController:animated:]) as the receiver instead of the tab bar. I seem to recall doing this once (quite by accident) and the tab bar remained visible.
One more thought: since each of your five view controllers is a UINavigationController, you could always pushViewController:animated: onto the selected view controller, then hide the back button. Your view will just appear without animation. But you'll need to remember to pop your view controller off the stack whenever the user switches to another tab. That might take a bit more work.
The best idea I could think of would be to either push a modal navigation controller for your view (which would hide the tab bar which you do not want), or to get the tab bar controller current selected view controller (really your navigation controller for a tab) and push your new view controller on there - and then pop that view when another tab is selected with a tab bar delegate.
It seems wierd to me to push the view onto random tabs though, if the view is created from a dialog that is modal, I don't see why the view itself should not also be modal and hide tabs.

Resources