MBProgressHud是第三方控件,可以進行將文件拖到自己工程中声旺,也可以使用COCOPods.這里現(xiàn)附上一github地址:https://github.com/jdg/MBProgressHUD
找到資源后的就是集成到自己的工程中了谐鼎。
cocopds方式:
1:終端中 cd+自己文件的路徑(找到自己文件的路徑舰蟆,拖到終端中);
2:pod init
3:vim Podfile
4:pos install
在就是將文件拖到自己的工程中的另一中方法狸棍;
這里是提示框的類型身害;
MBProgressHUDModeIndeterminate,
/// A round, pie-chart like, progress view.
MBProgressHUDModeDeterminate,
/// Horizontal progress bar.
MBProgressHUDModeDeterminateHorizontalBar,
/// Ring-shaped progress view.
MBProgressHUDModeAnnularDeterminate,
/// Shows a custom view.
MBProgressHUDModeCustomView,
/// Shows only labels.
MBProgressHUDModeText
上代碼:
//初始化mbproressHUD并添加到當(dāng)前視圖上;
theHUD=[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[self.view addSubview:theHUD];
//設(shè)置MBProgressHUD的樣式草戈;
theHUD.mode= MBProgressHUDModeText;
//字體內(nèi)容
theHUD.label.text=@"Loading";
//設(shè)置HUD背景顏色塌鸯;
theHUD.tintColor=[UIColor grayColor];
[theHUD showAnimated:NO];
//設(shè)置背景框的透明度;
theHUD.alpha=0.3;
//設(shè)置字體的大刑破丙猬;
theHUD.label.font=[UIFont systemFontOfSize:15];
//設(shè)置字體的顏色;
theHUD.label.textColor=[UIColor redColor];
//設(shè)置副標(biāo)題费韭;
theHUD.detailsLabel.text=@"等待中";
//設(shè)置動畫的類型茧球;
theHUD.animationType=MBProgressHUDAnimationFade;
[theHUD showAnimated:YES];
//設(shè)置控件在現(xiàn)實多長時間后消失;
[theHUD hideAnimated:YES afterDelay:10];
//添加計時器星持;
thetimer=[NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(timerMethod) userInfo:nil repeats:YES];
//開啟計時器抢埋;
[thetimer fire];
i=0;
計時器的響應(yīng)方法這里主要是設(shè)置MBprogress控件中的動畫進行;
-(void)timerMethod
{
//設(shè)置進行自增到1钉汗;
i+=0.1;
if (i==1)
{
//銷毀計時器羹令;
[thetimer invalidate];
}
NSLog(@"%f",i);
//在這里進行使用自增后的數(shù)值進行賦值鲤屡;MBprogress中的屬性progress屬性的最大值為1损痰;
theHUD.progress=i;
}
![Uploading QQ20171027-140611-HD_729416.gif . . .]