您好我为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;*/
}
}
}
任何人都知道为什么我会收到这个错误?
答案 0 :(得分:3)
public class PunteamPickerRederer : PunteamPicker
应该是
public class PunteamPickerRederer : PickerRenderer