假设我有一个自定义视图,我想向它添加手势识别器。
UIPanGestureRecognizer* y = a.panGestureRecognizer;
y.minimumNumberOfTouches = 2;
y.maximumNumberOfTouches = 2;
[self addGestureRecognizer:y];
将panGestureRecognizer
的a
加到后self
,a
就不再有 了panGestureRecognizer
。
我应该怎么做,即使在将 UIPanGestureRecognizer 添加到 后self
,a
它仍然可以自己拥有(例如复制它)?
我按照meronix的建议尝试了这个,但得到了例外。
UIPanGestureRecognizer* y = [a.panGestureRecognizer copy]; //I'm using ARC so I didn't add autorelease.
[self addGestureRecognizer:y];
-[UIScrollViewPanGestureRecognizer copyWithZone:]: unrecognized selector sent to instance 0x1c5c2460