我有一个自定义按钮:
public class CustomButton : UIButton
{
public void HandleTouchUpInside(object sender, EventArgs ea)
{
Console.Write("test tap");
}
}
所以我想在此类中重写TouchUpInside事件...该怎么做?
最佳答案
对您有用吗?
public class CustomButton : UIButton
{
public CustomButton()
{
TouchUpInside += HandleTouchUpInside;
// or new EventHandler(HandleTouchUpInside)
// if Xamarin compiler/runtime doesn't allow such shorter code
}
public void HandleTouchUpInside(object sender, EventArgs e)
{
Console.Write("test tap");
}
}
关于c# - 如何在CustomButton类中重写TouchUpInside事件?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/28687996/