應用顯示UIAlertview,我使用NSTimer 調用removeFromSuperView刪除警報。警報移除後,所有的操作都在當前視圖進行了,應該怎麼解決?
顯示警告的代碼:
UIAlertView *alert=[UIAlertView alloc]initWithTitle:@"A" message:@"B" delegate:self cancelButtonTitle:nil otherButtonTitles:nil, nil];
[alert show];
[alert release];
[NSTimer scheduledTimerWithTimeInterval:4.0 target:self selector:@selector(removeAlert:) userInfo:nil repeats:NO];
用timer調用方法:
-(void)removeAlert:(id)sender
{
[alert_View removeFromSuperview];
}
取消UIAlertView的顯示
[alert dismissWithClickedButtonIndex:0 animated:YES];