我正在研究Xamarin.iOS。当我长按UITableCell
UITableView
某个特定菜单UIActionSheet
时,我需要这样做。
我曾尝试在Xamarin官方网站上使用这些来源,但我失败了。 有人这么做过吗?
答案 0 :(得分:3)
在此sample中,我设法通过在GrowRowTableCell
public GrowRowTableCell (IntPtr handle) : base (handle)
{
var longPressGesture = new UILongPressGestureRecognizer (LongPressMethod);
AddGestureRecognizer (longPressGesture);
}
void LongPressMethod (UILongPressGestureRecognizer gestureRecognizer)
{
if(gestureRecognizer.State == UIGestureRecognizerState.Began)
{
Console.Write("LongPress");
var selectCategory = new UIActionSheet ("ActionSheet", null, "Cancel", "test");
selectCategory.ShowInView (this);
}
}
看起来像这样: