ios----MBProgressHUDプロンプトボックスの使用
954 ワード
1.初歩的に簡単なテキスト表示の使用
インタフェースを表示します.mファイル内
インタフェースを表示します.mファイル内
#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];
// block
* vc_self = self;
self.toastView.completionBlock = ^{
[vc_self.toastView removeFromSuperview];
vc_self.toastView = nil;
};
}