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.
Related
I have an app that uses a SFSafariViewController. The user clicks on a button and a webview appears inside the app presenting the contents of the site. I'm using XCUITest framework to test the UI.
I notice that when the webview appears, the navigation bar and the bottom tool bar seem to always have the same UI elements.
Navigation Bar UI Elements (going from left to right):
"Done" Button
URL link
Reload button
Bottom Tool Bar UI Elements (going from left to right):
Back arrow button
Forward arrow button
Share button
Open In Safari button
From a UI test standpoint, can I assume that these UI elements will always be present as default for a SFSafari VC?
You can see the full configuration available for SFSafariViewController here: https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller/dismissbuttonstyle. From what I can see, here's what can be configured out of the box:
The "done" button on the top left can be changed to look differently (Done, Close and Cancel are the options): https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller/dismissbuttonstyle
You can make the top nav bar "collapsable" with the barCollapsingEnabled property. https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller/configuration/2887469-barcollapsingenabled
You can change the preferred tint colors of the bar and the controls (buttons).
Other than that, SFSafariViewController has few options available for customization.
So the answer to your question is: No, you can't assume these elements will always be present. However, in most scenarios they will be. In general, I wouldn't assume anything anyway, because Apple could always change it in future iOS versions.
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).
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.
I need to develop tab bar similar to Chrome's tab bar functionality on iPad. If the user opens more then 5 tabs it displays the extra tabs as a stack:
stacked tabs http://uploads.hipchat.com/26718/169836/yfzwdgq80m4rzbw/Screen%20Shot%202013-04-10%20at%202.36.56%20PM.png
How can I achieve this?
There's nothing like that built into iOS, so you're going to have to implement it yourself. I'd suggest implementing the tab bar portion of the window as a separate view that knows how to draw the individual tabs, including the currently selected tab, and which sends an appropriate message to it's target or delegate object when one of the tabs is tapped.
You can build a UINavigationController like Controller, with its own stack. If you are targeting iOS 5.0 and above you can use childViewController. The controller will have a tab bar, and container view. You will add view controllers to the stack of the Controller. From the stack you can form the tab bar item View, using titles of respective vc and views can overlap.
When they are selected bring the tab bar item view to the front and add the respective viewController as childViewController to the CustomTabBarController.