我試圖在屏幕上一個接一個地顯示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