jdg / MBProgressHUD

MBProgressHUD + Customizations
http://www.bukovinski.com/
MIT License
16.01k stars 3.56k forks source link

hud在Debug View Hierarchy上显示和我页面显示的效果不同 #629

Open bosszhu opened 2 years ago

bosszhu commented 2 years ago

image image 奇怪的现在,我的界面显示hud被tableview遮挡,但是我打开图层显示在最上方,而且不管怎么调整显示的window还是无法做到在最上层显示,求解决办法

bosszhu commented 2 years ago
- (void)showProgress {
    if(progress == nil) {
//        progress = [[MBProgressHUD alloc] initWithView:self.view];
        UIWindow *keyWindow;
        keyWindow = [UIApplication sharedApplication].windows.lastObject;
        progress = [[MBProgressHUD alloc] initWithWindow:keyWindow];
        UIImageView * custom = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ic_progress_loading"]];
        progress.customView = custom;
        progress.detailsLabelText = @"加载中...";
        progress.detailsLabelFont = [UIFont systemFontOfSize:14.0f];
        // 设置模式
        progress.mode = MBProgressHUDModeCustomView;
        // 隐藏时候从父控件中移除
        progress.removeFromSuperViewOnHide = YES;
        [self.view addSubview:progress];
    }
    [progress show:YES];
    [self startNewAnimation];
}

此处是相关代码

dagundejuzi commented 2 years ago

加个 [self.view bringSubviewToFront:progress]; 试试

ZhangXueFei commented 2 years ago

UIWindow *window = [UIApplication sharedApplication].windows.firstObject

FadeFei commented 2 years ago

调用showProgress的上下文有么?