和github上的demo其實差不多,就是小整理了下,當備忘,想做複雜的效果可以參考mbprogresshud在github上的demo,寫得也很清楚明了。
以下是**:(先在.h檔案裡定義 mbprogresshud *hud;)
[cpp]
view plain
copy
//方式1.直接在view上show
hud = [[mbprogresshud showhudaddedto:self.view animated:yes] retain];
hud.delegate = self;
//常用的設定
//小矩形的背景色
hud.color = [uicolor clearcolor];//這兒表示無背景
//顯示的文字
hud.labeltext = @"test"
; //細節文字
hud.detailslabeltext = @"test detail"
; //是否有庶罩
hud.dimbackground = yes;
[hud hide:yes afterdelay:2];
//只顯示文字
mbprogresshud *hud = [mbprogresshud showhudaddedto:self.view animated:yes];
hud.mode = mbprogresshudmodetext;
hud.labeltext = @"some message..."
; hud.margin = 10.f;
hud.yoffset = 150.f;
hud.removefromsuperviewonhide = yes;
[hud hide:yes afterdelay:3];
//方式2.initwithview
//use block
hud = [[mbprogresshud alloc] initwithview:self.view];
[self.view addsubview:hud];
hud.labeltext = @"test"
; [hud showanimated:yes whileexecutingblock:^ completionblock:^];
//圓形進度條
hud = [[mbprogresshud alloc] initwithview:self.view];
[self.view addsubview:hud];
hud.mode = mbprogresshudmodeannulardeterminate;
hud.delegate = self;
hud.labeltext = @"loading"
; [hud showwhileexecuting:@selector(myprogresstask) ontarget:self withobject:nil animated:yes];
//自定義view
hud = [[mbprogresshud alloc] initwithview:self.view];
hud.customview = [[[uiimageview alloc] initwithimage:[uiimage imagenamed:@"37x-checkmark.png"
]] autorelease];
// set custom view mode
hud.mode = mbprogresshudmodecustomview;
hud.delegate = self;
hud.labeltext = @"completed"
; [hud show:yes];
[hud hide:yes afterdelay:3];
**方法:
[cpp]
view plain
copy
#pragma mark -
#pragma mark hud的**方法,關閉hud時執行
-(void
)hudwashidden:(mbprogresshud *)hud
二個task
[cpp]
view plain
copy
-(void
) dotask
-(void
) myprogresstask
}
用起來還是很easy的。
MBProgressHUD的基本使用
和github上的demo其實差不多,就是小整理了下,當備忘,想做複雜的效果可以參考mbprogresshud在github上的demo,寫得也很清楚明了。以下是 先在.h檔案裡定義 mbprogresshud hud cpp view plain copy 方式1.直接在view上show hud...
MBProgressHUD的基本使用
和github上的demo其實差不多,就是小整理了下,當備忘,想做複雜的效果可以參考mbprogresshud在github上的demo,寫得也很清楚明了。以下是 先在.h檔案裡定義 mbprogresshud hud cpp view plain copy 方式1.直接在view上show hud...
MBProgressHUD的基本使用
和github上的demo其實差不多,就是小整理了下,當備忘,想做複雜的效果可以參考mbprogresshud在github上的demo,寫得也很清楚明了。以下是 先在.h檔案裡定義 mbprogresshud hud 方式1.直接在view上show hud mbprogresshud showh...