我正在使用 MBProgressHUD ,当我将它添加到self.view时,它是不可见的。但是,如果我将它添加到tableview,它是可见的。在其他项目我曾经将它添加到self.view并且它正常工作。在该视图中,还存在tableview。你能帮我解决这个问题吗?
答案 0 :(得分:3)
我设置了MBProgressHUD视图的 layer.zPosition ,现在它可见了。
答案 1 :(得分:0)
您可以在appDelegate文件
中写下此内容+(AppDelegate *)getdelegate
{
return (AppDelegate *)[UIApplication sharedApplication].delegate;
}
-(void)showIndicator
{
[MBProgressHUD showHUDAddedTo:self.window animated:YES];
}
-(void)hideIndicator
{
[MBProgressHUD hideHUDForView:self.window animated:YES];
}
每当你想在你的viewcontroller中显示MBProgressHUD时写这个
[[AppDelegate getdelegate]showIndicator];
隐藏
[[AppDelegate getdelegate]hideIndicator];
希望它有所帮助。
答案 2 :(得分:0)
只需将其添加到[[UIApplication sharedApplication].delegate window]
,因为您只需要一个HUD实例。
答案 3 :(得分:0)
如果您使用UITableViewController
,则不允许将子视图添加到自身。
Here你可以找到一个黑客,它将解决这个问题