如果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