设置MBProgressHUD超时

菲斯特

下载Web服务数据时,我正在使用MBProgressHUD显示活动指示器。该应用程序将经常用于连接性较差的农村地区,因此我希望能够将HUD设置为10秒(仅是一个任意数字)。我不确定该怎么做。谁能提供建议?谢谢!

MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:self.view];

NSString *info = [NSString stringWithFormat:@"Loading %@ gauges", self.stateIdentifier];
[hud setLabelText:info];
[hud setDetailsLabelText:@"Please wait..."];
[hud setDimBackground:YES];
[hud setOpacity:0.5f];
[hud show:YES];

[self.view addSubview:hud];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
    stateGauges = [[GaugeList alloc] initWithStateIdentifier:stateIdentifier andType:nil];
    dispatch_async(dispatch_get_main_queue(), ^{
        [self.tableView reloadData];
        [hud removeFromSuperview];
    });
});
Midhun MP

您可以使用:

- (void)hide:(BOOL)animated afterDelay:(NSTimeInterval)delay;

MBProgressHUD方法

MBProgressHUD像这样创建

MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:self.view];
[self.view addSubview:hud];
NSString *info = [NSString stringWithFormat:@"Loading %@ gauges", self.stateIdentifier];
[hud setLabelText:info];
[hud setDetailsLabelText:@"Please wait..."];
[hud setDimBackground:YES];
[hud setOpacity:0.5f];
[hud show:YES];
[hud hide:YES afterDelay:10.0];

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章