1.初步簡單的文本顯示使用
顯示界面的 .m文件中
導(dǎo)入
#import "MBProgressHUD.h"
屬性
@property (nonatomic,strong) MBProgressHUD* toastView;//彈出提示
懶加載
-(MBProgressHUD*) toastView{
if (!_toastView) {
_toastView = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
_toastView.minShowTime = 2;
[_toastView setMode:MBProgressHUDModeText];
_toastView.contentColor = [UIColor grayColor];
_toastView.bezelView.backgroundColor = [UIColor blackColor];
}
return _toastView;
}
需要提醒的方法中
//彈出toast的文字
-(void)getToastString:(NSString*)str{
self.toastView.label.text = str;
[self.toastView hideAnimated:YES];
//隱藏掉之后回執(zhí)行的block
需要彈出的界面* vc_self = self;
self.toastView.completionBlock = ^{
[vc_self.toastView removeFromSuperview];
vc_self.toastView = nil;
};
}
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者