如果ViewController
的視圖設置爲MyView
哪裏在ViewController應UIGestureRecognizer設置?
和ViewController保持一個指向它的視圖(通過故事板設置)
@property (weak, nonatomic) IBOutlet MyView *v;
凡在ViewController
,應該發生以下情況嗎?
UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc]
initWithTarget:v action:@selector(pan:)];
[v addGestureRecognizer: panGesture];
。有v已經創建。 – beryllium 2012-03-27 18:55:25
爲什麼不在故事板中拖動手勢識別器? – dasdom 2012-03-27 19:01:48
@dasdom我發現代碼更清晰 – JAM 2012-03-27 19:20:42