我使用过FlowListView,但在iOS中无法正常工作?

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

我已经创建了一个用于画廊视图的示例。为此,我使用了flowlistview nuget。在Android上运行正常,但在iOS上网格中显示了一个奇怪的箭头。有什么主意吗?

UserPhotos.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:flv="clr-namespace:DLToolkit.Forms.Controls;assembly=DLToolkit.Forms.Controls.FlowListView"
    x:Class="MyApp.UserPhotos"
    Title="Photos">

    <ContentPage.Content>
        <StackLayout Padding="10" Margin="5">
            <flv:FlowListView 
                HasUnevenRows="True"
                FlowColumnCount="2"
                FlowItemTappedCommand="{Binding ItemTappedCommand}"
                SeparatorVisibility="Default"
                FlowItemsSource="{Binding userAlbumsList}">

                <flv:FlowListView.FlowColumnTemplate>
                    <DataTemplate>
                        <Frame x:Name="itemTemp"
                               Margin="5"
                               CornerRadius="5"
                               BackgroundColor="#5d6d20"
                               HorizontalOptions="FillAndExpand"
                               VerticalOptions="FillAndExpand">
                            <StackLayout Padding="0,8,0,8"
                                         VerticalOptions="Center"
                                         HorizontalOptions="Center">
                                <Image Aspect="AspectFit"
                                       HeightRequest="60"
                                       WidthRequest="60"
                                       Source="album.png"
                                       HorizontalOptions="CenterAndExpand"
                                       VerticalOptions="CenterAndExpand" />
                            </StackLayout>
                        </Frame>
                    </DataTemplate>
                </flv:FlowListView.FlowColumnTemplate>

            </flv:FlowListView>
        </StackLayout>
    </ContentPage.Content>

</ContentPage>

Output:

c# xamarin xamarin.forms xamarin.ios
1个回答
0
投票

您可以使用CustomRenderer设置iOS中单元格的Accessory

using UIKit;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;

using xxx.iOS;

[assembly:ExportRenderer(typeof(ViewCell),typeof(MyCellRenderer))]
namespace xxx.iOS
{
    public class MyCellRenderer:ViewCellRenderer
    {
        public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
        {

         //   reusableCell.EditingAccessory = UITableViewCellAccessory.DisclosureIndicator;
            var cell =  base.GetCell(item, reusableCell, tv);
            cell.Accessory = UITableViewCellAccessory.None;

            return cell;
        }
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.