UIButton mit benutzerdefinierten Ansicht - addTarget:action:forControlEvents: funktioniert nicht

Mein button ist wie folgt

  1. Erstellt label1
  2. Erstellt label2
  3. Erstellt customView (UIView)
  4. Hinzugefügt label1 und label2 auf benutzerdefinierte Ansicht
  5. Erstellt myCustomButton(UIButton)
  6. Hinzugefügt customView auf myCustomButton

Habe ich bereits getan, userInteractionEnable für custom_View, label1 und label2.

Dann Hinzugefügt

[myCustomButton addTarget:self action:@selector(OnButtonClick:) forControlEvents:UIControlEventTouchUpInside];

Und

-(void)OnButtonClick:(UIButton *)sender
{
}

Aber obige Funktion wird nie aufgerufen, auch, wenn ich Tippen Sie auf die Schaltfläche. Jede Lösung?

  • Setzen Sie bitte Ihre relevanten code hier ?
InformationsquelleAutor Sagrian | 2013-05-08
Schreibe einen Kommentar