嗨,伙计们,我有一个名为的方法manageui
,它会显示一段时间的等待视图,当超时时,它UIAlertView
会显示一条消息以重试我的问题是我无法隐藏UIAlertView
调用之前的manageui
调用
这是我的代码:
-(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 的代表是:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
[alertView dismissWithClickedButtonIndex:1 animated:true];
[spinner setHidden:NO];
alertView.hidden=YES;
[self mangeui];
}