我想在我的应用程序中显示HUD的混合,所以例如,当用户点击“登录”时,我想让我的HUD显示微调器说“登录...” ,然后更改为“登录!”的复选标记图像,然后隐藏。我想这个使用下面的代码来完成:这里MBProgressView睡眠混合视图
MBProgressHUD *HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
HUD.labelText = @"Logging in";
\\Do network stuff here, synchronously (because logging in should be synchronous)
\\ Then upon success do:
HUD.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkmark.png"]];
HUD.mode = MBProgressHUDModeCustomView;
HUD.labelText = @"Logged in!";
sleep(2);
[MBProgressHUD hideHUDForView:self.view animated:YES];
问题,就是sleep(2)
被应用到最初的微调,而不是对号HUD。所以微调器显示的时间更长,并且复选标记在瞬间消失后消失。我怎样才能做到这一点,以便勾选在HUD隐藏之前保持更长时间?
谢谢!
酷!啊,我的坏,这是一个重复的问题措辞有点不同。由stavash建议的代码在这里:http://stackoverflow.com/questions/7308922/mbprogresshub-mixed-view?rq=1 – quantum 2012-07-20 15:17:24