2
我米使用Xamarin
爲iOS
和我有一個自定義視圖(從UIView
繼承),我嘗試添加一個簡單的UIPanGestureRecognizer
,看到這一點:UIPanGestureRecognizer上自定義視圖從來沒有所謂
UIPanGestureRecognizer panGesture = new UIPanGestureRecognizer (() => Console.WriteLine ("Pan");
this.AddGestureRecognizer(panGesture);
但「潘「從未在控制檯中顯示:/
再次,我有一個自定義視圖。
編輯: 當我將我的代碼:
UIView myView = new UIView (new RectangleF(0,0,200,200));
myView.BackgroundColor = UIColor.Red;
myView.UserInteractionEnabled = true;
var recognizer = new UIPanGestureRecognizer ((g) => {
Console.WriteLine ("Panning detected");
Console.WriteLine ("Gesture recognizer state: {0}", g.State);
});
myView.AddGestureRecognizer (recognizer);
AddSubview(MyView的); 到UIVIewController
這個工程://///爲什麼?
我應該用UIGestureDelegate
做些什麼?
首先,感謝您的回答。其次,你確定?!因爲我不能設置這個值... – gran33 2015-01-21 09:54:42
是的,你必須設置這個值,以便panRecognizer知道什麼時候它必須開始工作:) – 2015-01-21 09:56:22
但文檔默認說它是默認的1:/ – gran33 2015-01-21 09:57:16