gpt4 book ai didi

ios - 无法创建Xamarin Forms Picker自定义渲染器

转载 作者:行者123 更新时间:2023-12-01 18:49:48 24 4
gpt4 key购买 nike

嗨,我很容易为Forms Entry控件创建自定义渲染器,但是当我尝试为Picker创建一个渲染器时,出现此错误:

Error CS0115: `Punteam.iOS.PunteamPickerRederer.OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs<Xamarin.Forms.Picker>)' is marked as an override but no suitable method found to override (CS0115) (Punteam.iOS)

这是我在Forms项目上的代码:
using System;
using Xamarin.Forms;

namespace Punteam
{
public class PunteamPicker : Picker
{
}
}

在IOS项目上:
using Xamarin.Forms.Platform.iOS;
using Xamarin.Forms;
using Xamarin.Forms.Platform;
using Punteam;
using Punteam.iOS;
using UIKit;
using EventKitUI;

[assembly: ExportRenderer (typeof(PunteamPicker), typeof(PunteamPickerRederer))]

namespace Punteam.iOS
{

public class PunteamPickerRederer : PunteamPicker
{
protected override void OnElementChanged (ElementChangedEventArgs<Picker> e)
{
/* base.OnElementChanged (e);

this.Control.TextAlignment = MonoTouch.UIKit.UITextAlignment.Center;

this.Control.TextColor = UIColor.White;

this.Control.BackgroundColor = UIColor.Clear;
this.Control.BorderStyle = UITextBorderStyle.RoundedRect;
this.Layer.BorderWidth = 1.0f;
this.Layer.CornerRadius = 4.0f;
this.Layer.MasksToBounds = true;
this.Layer.BorderColor = UIColor.White.CGColor;*/
}
}
}

任何人都知道为什么我会收到此错误?

最佳答案

public class PunteamPickerRederer : PunteamPicker

应该
public class PunteamPickerRederer : PickerRenderer

关于ios - 无法创建Xamarin Forms Picker自定义渲染器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32087187/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com