我试图在屏幕上一个接一个地显示2 MBProgressHUD消息。我发现第二条消息与第一条消息重叠,而不是串行显示。这就是我要做的:MBProgressHUD - 2个连续的消息重叠
我有一个注销按钮点击的时候触发这一点,并称之为“saveCartNotification”
- (IBAction)logout:(id)sender {
[self saveCartNotification];
}
“saveCartNotification”的帖子有5秒的延迟MBProgressHUD,然后调用“ userLogOut”
- (void)saveCartNotification{
self.hud = [[MBProgressHUD alloc] initWithView:self.view];
self.hud.labelText = @"Saving your cart..";
self.hud.mode = MBProgressHUDModeIndeterminate;
self.hud.dimBackground = YES;
self.hud.animationType = MBProgressHUDAnimationFade;
[self.view addSubview:self.hud];
[self.hud show:YES];
[self.hud hide:YES afterDelay:5];
[self.hud show:YES];
self.hud.labelText = @"Saving Cart and Favorites";
[self.hud hide:YES afterDelay:5];
//Logout
[self userLogOut];
}
userLogOut现在张贴另一个MBProgressHUD消息具有5秒的延迟:
- (void)userLogOut{
self.hud = [[MBProgressHUD alloc] initWithView:self.view];
self.hud.labelText = @"Logging out securely";
self.hud.mode = MBProgressHUDModeIndeterminate;
self.hud.dimBackground = YES;
self.hud.animationType = MBProgressHUDAnimationFade;
[self.view addSubview:self.hud];
[self.hud show:YES];
[self.hud hide:YES afterDelay:5];
}
由于我连续使用这些方法,我的预期的行为是:
1)MBProgressHUD消息从 “saveCartNotification” 2)上述消息停留在5秒钟消失 3)MBProgressHUD消息来自“ userLogOut” 4)上述消息再次停留在5秒钟消失
但正在发生的事情是两个消息似乎都在屏幕上,同时与MBProgressHUD消息‘userLogOut saveCartNotification’重叠MBProgressHUD消息‘’。
您能否让我知道我错过了什么,以及我需要怎样做才能让我的消息依次连续发送。
非常感谢您的帮助。
谢谢, 迈克
我想你需要'MBProgressHUD' – tGilani 2013-03-20 06:32:08