0
J'aime:Je ne peux pas fermer la UIAlertView
**//some methods of myButton inheried from UIButton**
-(void)timerFireMethod:(NSTimer*)theTimer
{
UIAlertView *alert = [ [ UIAlertView alloc ] initWithTitle:@"hello" message:@"alerts" delegate:self cancelButtonTitle:@"cancel" otherButtonTitles:nil ];
[alert show];
}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
timer = [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(timerFireMethod:) userInfo:nil repeats:NO];
}
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
[timer invalidate];
}
1) Je touche le mais jusqu'à montrer la UIAlertView, puis je vais cliquer sur le bouton d'annulation de la UIAlertView, mais le UIAlertView ne ferme pas.
2) Si je retourne en [timer invalidate];
//[timer invalidate];
et aime comme je l'ai fait dans le code ci-dessus, la UIAlertView peut fermer.
Pourquoi?
Veuillez formater votre code. –
Je ne comprends pas votre question. Pouvez-vous le reformuler? – vodkhang
J'ai résolu ma question en changeant "répète: NON" à "répète: OUI". – lqf