大家好,我有一个名为 manageui
的方法,它会显示等待 View 一段时间,当超时时,它会显示 UIAlertView
,它会显示一条重试消息
我的问题是,在调用 manageui
之前,我无法隐藏 UIAlertView
这是我的代码:
-(void)mangeui
{
double Currenttime=0;
double ptime=Currenttime+5000;
NSLog(@"fire /n");
do
{
//add condition for found session
if (Currenttime<ptime)
{
NSLog(@"inside if");
[spinner setHidden:NO];
[alert setHidden:YES];
}
else
{
alert = [[UIAlertView alloc] initWithTitle:@"Oops:("
message:@"No device found \n Make sure bluetooth is activated and the devices are within range."
delegate:self
cancelButtonTitle:@"Tap to retry"
otherButtonTitles:nil];
[spinner setHidden:YES];
[alert show];
}
Currenttime+=1;
} while (Currenttime < ptime+1 &&[_matchmakingClient availableServerCount]==0);
}
alertview 的委托(delegate)是:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
[alertView dismissWithClickedButtonIndex:1 animated:true];
[spinner setHidden:NO];
alertView.hidden=YES;
[self mangeui];
}
最佳答案
试试这个:
[alertView解雇WithClickedButtonIndex:0动画:是];
关于objective-c - 当uialertview进入其委托(delegate)方法时如何隐藏它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12934970/