My app crashes when adding Gesture to Custom View (XIB). I am using Xcode version 6.4.
Below are the steps I followed to add a custom subview with tap gesture:
Added an XIB and a UIView subclass (MyView) to my project. And set the XIB class to MyView.
Added a TapGesture to MyView using Interface Builder
Created MyView object (myView) and added it as a sub view using
[addSubview:myView]
.When I run the app, it crashes
Removed the TapGesture in XIB and run again with no issues.
Code:
[[[NSBundle mainBundle] loadNibNamed:@"MyView" owner:self options:nil] firstObject];
Log:
-[UITapGestureRecognizer setFrame:]: unrecognized selector sent to instance 0x7f924a4ce910
Sometimes like this,
-[UITapGestureRecognizer superview]: unrecognized selector sent to instance 0x7f924a4ce910
Please advice.