I just re-used Rg.Plugins.Popup code for navigation transitions/animations between content pages to avoid default (buggy) navigation in android. It's working good but the thing is that I could not get the navigation bar working (actually it is missing). Is there anyway to make it work like default navigation bars? (with back icon, page title, etc).
Related
I have to add new screens to an existing app, that will use a different navigation bar style than the one that already exists and will be accessed from different screens. The idea would be to show the new Navigation Bar style only for those screens, so when the user finishes that flow or goes back to the screen that started the navigation, it should show again the navigation bar style it was previously using.
I have tried 2 things but didn't work as expected:
I thought of wrapping the new screens in a new UINavigationController, so I could change its navigation bar style and it would be consistent for the new screens. It works but the problem is that I am not able to customize the initial UINavigationController transition to make it not look like a modal (i.e I want to show that UINavigationController with the same animation as if I were pushing a UIViewController). Is there a way to do that? By the way, I am managing the navigations with storyboards segues.
I also thought of using
self.navigationController?.navigationBar.isHidden = true
But doesn't seem clean because I would have to show it again when the flow is finished (it is a bit long) or cancelled. This makes a lot of combinations and it would be easy to miss one of them, so this doesn't seem a practical solution. Is there a better way to do this?
The presenting view controller is where you want to change the nav bar for the controller to be presented. So you'd make any changes to the navbar just before you call push(viewController:animated:).
And then in viewWillAppear of still the presenting view controller you would reset the navbar to what it was initially.
NOTE: Keep in mind that depending on the kind of changes you're doing to the navbar, the transition might no longer be smooth. The user might see some flickering of sorts on the navbar, which would be poor UI/UX.
Edit: Another alternative
Alternatively, you could get rid of the navbar and instead implement your own header view that you can style however you want, to represent the navbar.
You can style it as a simple navbar with a title + back button.
You can style it to look like a navbar with large title
You can style it as a navbar with back button + background image + title + right bar buttons
As you can see, this second alternative offers you more freedom in what you can do.
We have a project using a NavigationPage and TabbedPage working as expected in iOS but not Android (Xamarin Forms (2.3.3.193) with Prism (6.3.0)).
I've set up a sample project available here.
This application consists of three pages which are nested in a NavigationPage and a TabbedPage (APage, BPage and CPage) and a fourth page which should lose the TabbedPage and keep a NavigationPage (B1Page is available through BPage).
NavigationService.NavigateAsync("NavigationPage/LayoutTabbedPage/APage");
Opening APage with navigation and tab bar on iOS and looks fine on Android
BPage has an 'Add' button on the navigation bar which also looks fine on Android
Clicking 'Add' should open B1Page. This still has the navigation bar (with a 'Save' button instead of 'Add') but no tab bar.
m_navigationService.NavigateAsync("NavigationPage/LayoutTabbedPage/BPage/B1Page");
But on Android B1Page the tab bar remains and as does the original navigation bar (with the Add button instead of Save).
Is there something wrong I'm doing with navigation which makes these inconsistent?
Yes, you have issues with your navigation. First off, if you want to navigate within a TabbedPage and keep your tabs, you need to wrap your Tab in a NavigationPage, not the TabbedPage in a NavigationPage. Something like this:
<NavigationPage Title="B">
<x:Arguments>
<local:BPage />
</x:Arguments>
</NavigationPage>
This will allow yo to navigate within the actual Tab.
If this is not what you want to do, then keep your tabbedPage wrapped in a navigation page and then when you navigate to B1Page force an async nav call using 'NavigateAsync("B1Page", usemodalNavigation: false)`. This will bounce you out of the tabbed page but keep you within the navigation page with the back arrow and toolbar item.
Secondly, your navigation Uri's are a mess. Navigation in Prism is relative to where you are calling it.
When you make this call m_navigationService.NavigateAsync("NavigationPage/LayoutTabbedPage/BPage/B1Page"); you are pushing all those pages onto the navigation stack again. If you hit your back button on Android you will see what I mean.
All you have to do is from BPageViewModel call NavigateAsync("B1Page");.
That should get you pointed in the right direction.
I'm started to work at new place as iOS programmer. I joined existing project and got an assignment that i don't really know how to approach.
So my problem is this: when you press a button, next window has to have a tab bar with four icons, this means four different navigation stacks. Its not that hard to make, but in main screen i have more then four icons, and if i press any one of them next window always has to have a tab bar with four static icons, like shortcuts or something.
So what should I do? Does anyone had the same situation? I want to start with a good advice to save trouble later on.
You should probably rethink the app design. Tapping an item on the tab bar shouldn't result in a different number of tab bar items, as it leads to an unstable and unpredictable UI.
While not the most efficient in terms of visible content, you could introduce a segmented control (or a similar custom view) on top right under the navigation bar (if there is one), as seen in the Facebook app (though here it is used to perform actions, not changing views).
Your root view controller should be embedded in a navigation controller. Then push a view controller which contains any number of tab bar items not TabBarController. Then you can present each view controller either push or custom.
This is a simple question. So I have a tabbed bar application with a More... tab button. I was wondering if it's possible to make the More... button be a slide out menu button? I found tutorials on how to do it on a regular app design but things get a little more complicated when it comes to the tabbed bar application.
The thing is that you don't own the More button in the tab bar of a UITabBarController, so you can't control what happens. (You can access the navigation controller that appears when the More button is tapped, but it's still going to be just another view controller whose view is displayed above the tab bar.) If you want to write a new interface you'll have to write a whole new interface, i.e. don't use the built-in UITabBarController. That's no big deal; it isn't doing anything you can't manage to do yourself.
I'm doing iPhone tabbed application, but I need to use navigation bar also (just for app title and single icon for Settings in the corner) like twitter did: link. I have 4 tabs in my app too. I was wondering is there any chance to create only one navigation bar, so when I want to change it, I will change it only in one place?
I was looking at this tutorial, but there are two "Navigation Bar" objects. And I would like to have single object that will appear in every tab.
Right now I created tabbed app and manually added navigation bar item into first tab. Then I copied it into others. It works ofc, but I'm not sure about that solution:/
Your use of separate navigation controllers for each tab isn't a bad solution.
Setting up the navigation bar and its items in only one place is also a good idea. To achieve this, you could always have your view controllers derive from a custom view controller that overrides navigationItem.