如何在Xamarin中使用UISwipeGestureRecognizer?这是我到目前为止的代码,它没有用,当我滑动没有任何事情发生。
public override void ViewDidLoad()
{
base.ViewDidLoad();
// Perform any additional setup after loading the view, typically from a nib.
ImageView.Image = new UIImage((string)ListOfImages[0]);
var swipeRight = new UISwipeGestureRecognizer(this, new ObjCRuntime.Selector("swiped:"));
swipeRight.Direction = UISwipeGestureRecognizerDirection.Right;
ImageView.AddGestureRecognizer(swipeRight);
}
public void swiped(UIGestureRecognizer gesture)
{
Console.WriteLine("User swiped right");
}
答案 0 :(得分:0)
您需要使用与您使用的选择器相同的名称导出方法:
function DMC_n(){
DMC('Elements', [1,2]);
}
function DMC(shtName, arr){
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(shtName);
var range = sheet.getDataRange();
var values = range.getValues();
for (var i = 0; i <= arr.length -1; i++){
sheet.deleteColumns(arr[i]);
};
}
或者使用接受C#[Export("swiped:")]
public void swiped(UIGestureRecognizer gesture)
{
Console.WriteLine("User swiped right");
}
:
Action
答案 1 :(得分:0)
var swipeRight = new UISwipeGestureRecognizer(swiped);