MBProgressHUD cannot cover Keyboard in iOS16

42 Views Asked by At

When I try to show a MBProgressHUD while the keyboard is also showing, I use the code below but the HUD object cannot cover the keyboard

UIWindow *window=[[UIApplication sharedApplication].windows lastObject];
    
MBProgressHUD *HUD = [[MBProgressHUD alloc] initWithView:window];
[window addSubview:HUD];
HUD.label.font = SIMSystemFontWeightMedium(14);
HUD.label.numberOfLines = 0;
[HUD setY: SIMScreenHeight/2 -100];
HUD.label.text = CheckNilFromObj(text);
HUD.mode = MBProgressHUDModeText;
HUD.removeFromSuperViewOnHide = YES;
HUD.userInteractionEnabled = NO;
[HUD showAnimated:YES];
[HUD hideAnimated:YES afterDelay:1.8];
0

There are 0 best solutions below