UIButton avec vue personnalisée - addTarget:action:forControlEvents: ne fonctionne pas

Mon bouton est comme suit

  1. Créé label1
  2. Créé label2
  3. Créé customView (UIView)
  4. Ajouté label1 et label2 sur affichage personnalisé
  5. Créé myCustomButton(UIButton)
  6. Ajouté customView sur myCustomButton

Je l'ai déjà fait userInteractionEnable pour custom_View, label1 et label2.

Ensuite ajouté

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

Et

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

Mais la fonction n'est jamais appelée, même lorsque je touche le bouton. Toute solution?

S'il vous plaît mettez votre code ici ?

OriginalL'auteur Sagrian | 2013-05-08