Unable Correctly to Add Navigation Buttons Using UIPageViewController for iOS - ios

For my project UIPageViewController could be a good choice, so, I started with the template provided by XCode 6.4 starting new project. I used the template: Page-Based Application which has already the basic implementation of UIPageViewController. The opportunity to scroll the pages is working fine, however, I would like to add the navigation bar as well. After reading the articles on that topic I tried to embed DataViewController into NavigationController (Editor>Embed), and then added the Navigation Bar Button using the storyboard from Interface Builder. However, I cannot see that button when I compile the app. Moreover, it looks that the back navigation works for the pages when you press on the spot where Navigation Bar Button should be located, but button is not visible. Later I found out that the back navigation works not only on that spot but on all left margin of the view. It seems like a bug.
1. How to make Navigation Bar Back Button visible?
2. How to remove that buggy behavior when navigation reacts to the press of all the margin instead of just location of the button?

If you want to have the navigation controller show up, you need to change:
let startingViewController: DataViewController = self.modelController.viewControllerAtIndex(0, storyboard: self.storyboard!)!
so that startingViewController is the navigation controller your dataViewController is embedded in. You can do this by changing the storyboard ID of the navigation controller and saying something like:
let startingViewController: UIViewController = (self.storyboard?.instantiateViewControllerWithIdentifier("NavController"))!
However this is going to break the template as the rest of the code thinks the starting view controller is a DataViewController, so you will need to change that.
The "buggy behavior" is the standard page controller navigation mechanism when the transitionStyle is set to UIPageViewControllerTransitionStylePageCurl.

Related

iOS 8 Navigation Bar Not Accessible in Second ViewController on Storyboard

I am new to iOS development and have not tried this programmatically yet. I would prefer to get this working in a storyboard.
I'm following this somewhat outdated tutorial from XCode 4.5 in XCode 6.1 to create a series of views connected by one navigation controller.
http://youtu.be/rgd6mCuzlEc
Once I create the second view controller, I am unable to double click the navigation bar to change the name and I am unable to add a bar button to it.
I have a Segue going from bar button "Item" from view 1 to 2. Notice in the "View Controller Scene" there is no navigation item. If I add any elements to the view controller they fall under "View" and not under "View Controller", unlike view controller 1 where it falls under "one".
Is this a limitation on XCode? Am I using the wrong Segue (Show)? Is there a hidden setting or customization I'm missing?
I actually have this working for 2 view controllers and failing the 3rd in a separate project but I don't know what I did to do that so I'm pretty sure it's possible I just cannot reproduce..
EDIT: Workaround Instead of the new adaptive SHOW segue, use the deprecated PUSH segue, add the bar button items, then change back to the adaptive SHOW segue.
Try adding a Navigation Item to the controller and it should work properly

Tab bar controller is not showing bar button item

I'm new in Objective-C, and even more using storyboards. This being said I'm trying to use a bar button item within UITabBarController and UINavigationController as can you see in the image below.
But once I run the project in simulator this item is not showing. I would appreciate a non programmatically solution if it's posible.
Okay, so the way to do this:
When you create your tab view controller. You have to add a navigation controller that will handle each tab.
Tab View Controller --> navigation controller --> View Controller 1.
Then add the bar button item to view controller 1. Then go ahead and add the segues.
Now, still it won't show up.
But, if you go to your code for your view controller 1: Add a reference from the storyboard of your bar button item into your View Controller 1 file. Then, in ViewWillAppear():
self.tabBarController.navigationItem.rightBarButtonItem = _btnNewContact;
From there, it will show up and the segue you have configured in your storyboard should work perfectly! =)
After I spent a while trying to get the best way to do it I finally did that I should have done since begin. Read official apple documentation.
Parameters
viewController
The view controller that is pushed onto the stack. This object cannot be an instance of tab bar controller and it must not already be on the stack.
In other words, my approach is just a bad design.

TabBarController in NavigationController does not show TabBar in viewControllers

I have a UITabBarController to whose controllers I would like to attach navigation. So I inserted the NavigationController as the entry controller, and the tabBarController as its root. All seems working fine, but for the tabBar. Basically it does not show, albeit the StoryBoard I attach seems to say differently. I also attach the Account Screen not showing any navigation bar nor, of course, any back button.
Thanks,
Fabrizio
Just a quick answer. I think you should put UINavigationController inside the TabBarController instead of the other way round. It will solve most of your problems.
Steps: Editor -> Embed in -> Navigation Controller
See the below screen shot on how to add a Navigation Controller to a View Controller.
You are following wrong approach, IOS does not allow you to use tabbarview controller as root of navigation controller, it always display black screen. I have faced same problem and as a solution i have added navigation bar after tabbar controller. Yes it becomes difficult to manage, but you can use that way and it will work.
If you use programmatic approach instead of storyboard then it is possible, see this link
Even you can try from Editor option of XCODE, select tabbar controller you have added from storyboad then go to Editor->Embedded in, you will see that navigation bar controller is disable.
This is also give you idea that it will not work.

Adding sliding menu (left drawer) to my storyboard

So I was creating a app using TabBarController as my main means of navigation till now but to add more options and navigation options, I wish to add a Sliding Menu/Drawer with a button on Nav bar or by swipe gesture.
I found quite a few libraries to do this but decided to go with ECS since it supports storyboard
https://github.com/ECSlidingViewController/ECSlidingViewController
My current storyboard looks like this
My Tabbar was my initial viewcontroller till now and Home VC is the first screen that shows up
Any help will be appreciated, please see if you can post me code examples on how to do it aswell, kinda still new to ObjC

ios - UITabViewController working, but now my other segueys stopped working

I enabled o UITabView on the bottom of the screen, and that works, but the rest of my buttons on the app screen suddenly stopped working. Would anyone know why that might happen? I was using push segueys for them.
I think the issue may be that originally I have a NavigationController that I use on the app, and then the UITabBar controller interferes with it.
Thanks!
As per Apple recommendation, UITabBarController should only be the root controller of an app. I think what you are doing is you are having the UITabBarController nested in your UINavigationController, and that won't work.
You can instead select your navigation controller and embed it in a UITabBarController. (I don't have XCode with me now, but I think there's an option in the menu called Embed in -> Tab Bar Controller. You can search for it in Help.)
(If you need the tab bar controller to be nested under nav controller, I believe you need to use some buttons to fake its effect.)
If you only need a tab bar but not tabbar controller, then don't use tabbar controller.

Resources