@SZolotov
Asp.net core, MAUI,WPF,Qt, Avalonia

В чем ошибка при создпнии кастомной ячейки в UICollectionView?

Вот тут collectionView.DequeueReusableCell("identity", indexPath) as ImageCell результат всегда null, но если приводить к типу UICollectionViewCell все нормально и ячейка находится. В чем может быть проблема?
Реализация ImageCell:
public class ImageCell : UICollectionViewCell
    {
        UIImageView imageView;

        [Export("initWithFrame:")]
        public ImageCell(System.Drawing.RectangleF frame) : base(frame)
        {
            BackgroundView = new UIView { BackgroundColor = UIColor.Orange };

            SelectedBackgroundView = new UIView { BackgroundColor = UIColor.Green };

            ContentView.Layer.BorderColor = UIColor.LightGray.CGColor;
            ContentView.Layer.BorderWidth = 2.0f;
            ContentView.BackgroundColor = UIColor.White;
            ContentView.Transform = CGAffineTransform.MakeScale(0.8f, 0.8f);

            imageView = new UIImageView(UIImage.FromBundle("placeholder.png"));
            imageView.Center = ContentView.Center;
            imageView.Transform = CGAffineTransform.MakeScale(0.7f, 0.7f);

            ContentView.AddSubview(imageView);
        }

        public UIImage Image
        {
            set
            {
                imageView.Image = value;
            }
        }
    }

Спасибо.
  • Вопрос задан
  • 130 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы