2010-08-05 34 views
0

我不喜欢:我不能关闭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)我碰,但直到显示UIAlertView中,然后我去点击UIAlertView中的取消按钮,但UIAlertView中不会关闭。

2)如果我把[timer invalidate];//[timer invalidate];

和不喜欢,因为我在上面的代码一样,在UIAlertView中可以关闭。

为什么?

+0

请格式化您的代码。 – 2010-08-05 03:16:44

+0

我不明白你的问题。你能改述一下吗? – vodkhang 2010-08-05 03:31:54

+0

我通过将“重复:否”更改为“重复:是”来解决我的问题。 – lqf 2010-08-05 03:37:04

回答

0

您没有发布警报视图。

​​