Reputation: 1155
setting delegate for UITapGesture giving warning
Here is my code :
UITapGestureRecognizer *tapOtherPlayers = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapcollectionViewOtherPlayers:)];
tapOtherPlayers.delegate = self;
[tapOtherPlayers setNumberOfTapsRequired:1];
[collectionViewOtherPlayers addGestureRecognizer:tapOtherPlayers];
Upvotes: 1
Views: 1003
Reputation: 431
Make "tapOtherPlayers" Variable as global and set UIGestureRecognizerDelegate delegate as bellow.
@interface ViewController ()<UIGestureRecognizerDelegate>{
UITapGestureRecognizer *tapOtherPlayers;
}
@end
@implementation ViewController
- (void)viewDidLoad {
tapOtherPlayers = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapcollectionViewOtherPlayers:)];
tapOtherPlayers.delegate = self;
[tapOtherPlayers setNumberOfTapsRequired:1];
[collectionViewOtherPlayers addGestureRecognizer:tapOtherPlayers];
}
Hope this will help you...
Upvotes: 1
Reputation: 1949
You need to add UIGestureRecogniserDelegate in your .h file as following :
Hope it helps..
Upvotes: 6