我正在使用 MBProgressHUD
显示 toast 消息,但 toast 消息获得了一些 View 下面是代码正在使用
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:window.contentView animated:YES];;
// Configure for text only and offset down
hud.mode = MBProgressHUDModeText;
hud.labelText = @"some message......";
hud.margin = 10.f;
hud.yOffset = 200.f;
hud.removeFromSuperViewOnHide = YES;
[hud hide:YES afterDelay:20];
最佳答案
对于 macOS 使用 MBProgressHud
你可以这样显示
MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:window.contentView];
hud.mode = MBProgressHUDModeText;
hud.labelFont = [NSFont systemFontOfSize:13.0];
hud.margin = 8.f;
hud.opacity = 0.7;
hud.yOffset = NSHeight(window.frame)/2-60;
hud.cornerRadius = 4.0;
hud.removeFromSuperViewOnHide = YES;
hud.detailsLabelText = @"some message......";
[window.contentView addSubview:hud];
[hud show:YES];
[hud hide:YES afterDelay:2.0];
关于ios - 在 mac os 中使用 MBProgressHUD 显示 toast 消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55914836/