为什么点击事件或手势在IOS上的旋转木马页面中不起作用?

问题描述 投票:0回答:1

我想点击Carousel页面中的图片、方框或标签对象。安卓系统可以正常工作,但IOS系统不行,为什么?你能帮助或解释一下吗?

这里是简单的演示。

<CarouselPage xmlns="http://xamarin.com/schemas/2014/forms" 
          xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
          x:Class="CarouselPageNavigation.MainPage">
<ContentPage>
    <ContentPage.Padding>
        <OnPlatform x:TypeArguments="Thickness">
            <On Platform="iOS, Android" Value="0,40,0,0" />
        </OnPlatform>
    </ContentPage.Padding>
    <StackLayout>
        <Label Text="Green" FontSize="Medium" HorizontalOptions="Center" />
        <BoxView Color="Green" WidthRequest="200" HeightRequest="200" HorizontalOptions="Center" VerticalOptions="CenterAndExpand">
            <BoxView.GestureRecognizers>
                <TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped"></TapGestureRecognizer>
            </BoxView.GestureRecognizers>
        </BoxView>
    </StackLayout>
</ContentPage>

这里是.cs

        private void TapGestureRecognizer_Tapped(object sender, System.EventArgs e)
    {
        DisplayAlert("sdada", "sdada", "sdadada");
    }
xamarin xamarin.forms xamarin.ios
1个回答
0
投票

在xamarin.forms 4.5.0.617之前,我在Mac端更新到IOS SDK beta版,解决了这个问题。

现在这个问题已经解决了,你可以把Xamrin Forms更新到最新的4.5.0.617版本,然后就可以在iOS 13.4中工作了。

谢谢江小二

© www.soinside.com 2019 - 2024. All rights reserved.