Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从Shell页面到选项卡式页面的导航在ios中会导致问题-Xamarin.forms_Xamarin_Xamarin.forms - Fatal编程技术网

从Shell页面到选项卡式页面的导航在ios中会导致问题-Xamarin.forms

从Shell页面到选项卡式页面的导航在ios中会导致问题-Xamarin.forms,xamarin,xamarin.forms,Xamarin,Xamarin.forms,在我的xamarin.forms应用程序中,我正在使用shell组件。我有一个名为TimeSheetsTab的选项卡式页面。当我从Shell标签页导航到TimeSheetsTab时,在ios中它只显示一个黑色页面。在安卓系统中,它运行良好。请参考屏幕截图 我的Appshell页面 <?xml version="1.0" encoding="utf-8" ?> <Shell xmlns="http://xamarin.com/schemas/2014/forms"

在我的xamarin.forms应用程序中,我正在使用shell组件。我有一个名为TimeSheetsTab的选项卡式页面。当我从Shell标签页导航到TimeSheetsTab时,在ios中它只显示一个黑色页面。在安卓系统中,它运行良好。请参考屏幕截图

我的Appshell页面

<?xml version="1.0" encoding="utf-8" ?>
<Shell xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"             
             Shell.NavBarIsVisible="False"
             xmlns:local="clr-namespace:Sample.Views"
             x:Class="Sample.AppShell">

    <TabBar>
        <Tab Title="Dashboard" Icon="icon_dashboard.png" >
            <ShellContent ContentTemplate="{DataTemplate local:Dashboard}" />
        </Tab>

        <Tab Title="Notifications" Icon="icon_notifications.png">
            <ShellContent ContentTemplate="{DataTemplate local:Notifications}" />
        </Tab>

        <Tab Title="Account" Icon="icon_user.png">
            <ShellContent ContentTemplate="{DataTemplate local:Account}" />
        </Tab>
    </TabBar>


</Shell>
   private async void Button_Clicked(object sender, EventArgs e)
        {
            await Navigation.PushAsync(new TabPage(), true);           
        }
        <?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:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:Views="clr-namespace:Sample.Views"
             BarBackgroundColor="{DynamicResource NavigationBarColor}"
             mc:Ignorable="d"      
             NavigationPage.HasNavigationBar="False"
             Shell.BackgroundColor="{DynamicResource NavigationBarColor}"
             Shell.NavBarIsVisible="True"
             x:Class="Sample.Views.TimeSheetsTab">
    <Shell.TitleView>
        <StackLayout HorizontalOptions="FillAndExpand" Orientation="Horizontal" >
            <Label FontSize="Medium" Text="Timesheets" HorizontalTextAlignment="Start"  VerticalTextAlignment="Center" TextColor="White"></Label>
            <Image Source="search.png" HorizontalOptions="EndAndExpand" HeightRequest="25" Margin="0,2,10,2"></Image>
        </StackLayout>
    </Shell.TitleView>


    <TabbedPage.Children>
        <Views:PendingTimesheets Title="Pending" IconImageSource="icon_pending.png"/>
        <Views:ApprovedTimesheets Title="Approved" IconImageSource="icon_approved.png"/>
    </TabbedPage.Children>
</TabbedPage>
我的选项卡式页面

<?xml version="1.0" encoding="utf-8" ?>
<Shell xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"             
             Shell.NavBarIsVisible="False"
             xmlns:local="clr-namespace:Sample.Views"
             x:Class="Sample.AppShell">

    <TabBar>
        <Tab Title="Dashboard" Icon="icon_dashboard.png" >
            <ShellContent ContentTemplate="{DataTemplate local:Dashboard}" />
        </Tab>

        <Tab Title="Notifications" Icon="icon_notifications.png">
            <ShellContent ContentTemplate="{DataTemplate local:Notifications}" />
        </Tab>

        <Tab Title="Account" Icon="icon_user.png">
            <ShellContent ContentTemplate="{DataTemplate local:Account}" />
        </Tab>
    </TabBar>


</Shell>
   private async void Button_Clicked(object sender, EventArgs e)
        {
            await Navigation.PushAsync(new TabPage(), true);           
        }
        <?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:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:Views="clr-namespace:Sample.Views"
             BarBackgroundColor="{DynamicResource NavigationBarColor}"
             mc:Ignorable="d"      
             NavigationPage.HasNavigationBar="False"
             Shell.BackgroundColor="{DynamicResource NavigationBarColor}"
             Shell.NavBarIsVisible="True"
             x:Class="Sample.Views.TimeSheetsTab">
    <Shell.TitleView>
        <StackLayout HorizontalOptions="FillAndExpand" Orientation="Horizontal" >
            <Label FontSize="Medium" Text="Timesheets" HorizontalTextAlignment="Start"  VerticalTextAlignment="Center" TextColor="White"></Label>
            <Image Source="search.png" HorizontalOptions="EndAndExpand" HeightRequest="25" Margin="0,2,10,2"></Image>
        </StackLayout>
    </Shell.TitleView>


    <TabbedPage.Children>
        <Views:PendingTimesheets Title="Pending" IconImageSource="icon_pending.png"/>
        <Views:ApprovedTimesheets Title="Approved" IconImageSource="icon_approved.png"/>
    </TabbedPage.Children>
</TabbedPage>


我没有添加TimesheetTab子页面的代码,因为当直接导航到它时,它会正确显示。ios中出现问题的原因是什么?非常感谢您的帮助。

您是否将内容页用于“待处理时间表”和“已批准时间表”?如果您尝试在没有孩子的情况下使用它(检查问题出在哪里)@D.Nehl是的,我正在使用内容页查看待处理的时间表和ApprovedTimesheets@D.Nehl如果我直接导航到PendingTimesheets,它会起作用。如果你有Shell导航设置,为什么不使用Shell呢?可能要查看此页面以了解更多信息@FreakyAli那么我是否应该使用另一个shell作为我的内部选项卡而不是选项卡页?您是否使用ContentPage作为“PendingTimesheets”和“ApprovedTimesheets”?如果您尝试在没有孩子的情况下使用它(检查问题出在哪里)@D.Nehl是的,我正在使用内容页查看待处理的时间表和ApprovedTimesheets@D.Nehl如果我直接导航到PendingTimesheets,它会起作用。如果你有Shell导航设置,为什么不使用Shell呢?可能是查看这个@FreakyAli以了解更多信息,那么我应该为我的内部选项卡使用另一个shell而不是选项卡页吗?