2016-05-05 4 views
0

Einstellung Delegat für UITapGesture Warnen gibtRahmen Delegierter für UIGestureRecognizer Warnen gibt

Assigning to 'id<UIGestureRecognizerDelegate>_Nullable' from incompatible type 'TopPlayersViewController *const+strong'

Hier ist mein Code:

UITapGestureRecognizer *tapOtherPlayers = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapcollectionViewOtherPlayers:)]; 
tapOtherPlayers.delegate = self; 
[tapOtherPlayers setNumberOfTapsRequired:1]; 
[collectionViewOtherPlayers addGestureRecognizer:tapOtherPlayers]; 
+0

Sie habe den UIGestureRecognizerDelegate-Delegaten in der .h-Datei verwendet –

Antwort

2

Sie benötigen UIGestureRecogniserDelegate in Ihrer .h-Datei hinzufügen, wie folgend:

enter image description here

Hoffe, es hilft ..

+0

Was ist falsch in der Antwort ..? Jemand wurde abgelehnt? –

+0

Ja !! Jemand hat meine Antwort auch abgelehnt ... :( –

+0

woo .. das hat funktioniert! Hölle ... wie kann ich das vergessen !! Vielen Dank, Mann :) –

1

Fabrikat "tapOtherPlayers" Variable als global und setzen UIGestureRecognizerDelegate Delegat als Gebrüll.

@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]; 
} 

Hoffnung das wird Ihnen helfen ...

+0

Nein, dies gibt immer noch den gleichen Fehler. Ich habe es schon probiert! –