iOS   发布时间:2022-03-30  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了xaml – Xamarin在iOS上的TabbedPage中形成辅助ToolbarItem大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我的应用程序在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/scheR_395_11845@as/2014/forms"
            xmlns:x="http://scheR_395_11845@as.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/scheR_395_11845@as/2014/forms"
             xmlns:x="http://scheR_395_11845@as.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>
@H_733_7@mapPage.xaml

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/scheR_395_11845@as/2014/forms"
             xmlns:x="http://scheR_395_11845@as.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>
@H_874_24@解决方法
您可以在第一个“viewcontroller”中创建工具栏项,然后将其推到标签栏堆栈中.这些实例化为导航控制器的一部分.因此,当您加载没有任何信息传递到工具栏的第二页时,它不会显示但在技术上仍然是视图的一部分,因此它将空间呈现在顶部,我相信有一些如何停止这种行为,第一次使用AutoLayout继电器.

public MySecondPage()
    {
        InitializeComponent();
        NavigationPage.SetHasNavigationBar(this,falsE);  // Hide nav bar
    }

如果这不起作用让我知道,还有其他不太整洁的选择.

大佬总结

以上是大佬教程为你收集整理的xaml – Xamarin在iOS上的TabbedPage中形成辅助ToolbarItem全部内容,希望文章能够帮你解决xaml – Xamarin在iOS上的TabbedPage中形成辅助ToolbarItem所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。