I am aware that there are already many questions asked similar to this, but I have tried all of them, and on failing to solve my issue I am posting my question. First the questions I tried are:
1)How to get button.tag via longPressGestureRecognizer?
In my application I have 12 UIButtons
in my xib. On the long press of UIButton
I have this method getting called. Using gesture.view.tag
property always gives me same tag(i.e) every time when I click on different UIButtons
.
- (IBAction)longPress:(id)sender {
UILongPressGestureRecognizer* gesture=(UILongPressGestureRecognizer*)sender;
NSLog(@"Tag---> %d",gesture.view.tag);
}
My xib looks something like this:
Update 1:
Before someone gets confused with xib, I must say that UIButtons
are set to Custom type so they are invisible under UIImageView
.