本文介绍了在Mac OS中使用MBProgressHUD显示吐司消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MBProgressHUD显示烤面包消息,但是烤面包消息得到了一些视图下面是代码正在使用

I am showing toast message using MBProgressHUD but with toast message getting some view with it Below is code is using

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您可以像这样显示

For macOS Using MBProgressHud you can show like this

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];

这篇关于在Mac OS中使用MBProgressHUD显示吐司消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 13:46