[英]Xamarin Forms Secondary ToolbarItem in TabbedPage on iOS
我的应用程序在iOS上表现得非常奇怪,我有一个带有3个选项卡的TabPage。 在第一个图像上,您可以看到我在第一个Tab上有4个Secondary ToolbarItems。 奇怪的是在带有Map的Page上我没有Secondary ToolbarItem,NavigationBar和Map之间的空间仍然存在。 有没有人知道如何解决这个问题,或者这是否是Xamarin的Bug?
NavPage.xaml
<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:view="clr-namespace:CarPar.View;assembly=CarPar"
x:Class="CarPar.Navigation.NavPage"
Title = "{Binding PageTitle}">
<view:HomePage />
<view:MapPage />
<view:FavoritePage />
</TabbedPage>
HomePage.xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:view="clr-namespace:CarPar.View;assembly=CarPar"
x:Class="CarPar.View.HomePage"
Title="City"
Icon="home.png">
<ContentPage.ToolbarItems>
<ToolbarItem Text="Alphabetisch" />
<ToolbarItem Text="Freie Plätze" />
<ToolbarItem Text="Prozent frei" />
<ToolbarItem Text="Entfernung" />
</ContentPage.ToolbarItems>
<StackLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<SearchBar Placeholder="Parkhaus suchen" Text="{Binding SearchText}" />
...
<StackLayout>
</ContentPage>
MapPage.xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:maps="clr-namespace:Xamarin.Forms.Maps;assembly=Xamarin.Forms.Maps"
x:Class="CarPar.View.MapPage"
Title="Karte"
Icon="map.png">
<ContentPage.Content>
<StackLayout VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
<maps:Map x:Name="ParkingMap"
IsShowingUser="True"
MapType="Street"/>
</StackLayout>
</ContentPage.Content>
</ContentPage>
您可以在第一个“viewcontroller”中创建工具栏项,然后将其推到标签栏堆栈中。 这些实例化为导航控制器的一部分。 所以,当你加载没有任何信息传递到工具栏的第二页,它不显示,但在技术上仍视图的一部分,所以它呈现的空间在上面,我相信有几个如何停止这种行为,第一次使用AutoLayout继电器。
public MySecondPage()
{
InitializeComponent();
NavigationPage.SetHasNavigationBar(this, false); // Hide nav bar
}
如果这不起作用让我知道,还有其他不太整洁的选择。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.