iOS ----- MBProgressHUD、SVProgressHUD基本使用方法

来源:互联网 发布:网络赌钱 编辑:程序博客网 时间:2024/05/16 15:22

先附上 github 地址:

https://github.com/jdg/MBProgressHUD

https://github.com/TransitApp/SVProgressHUD

1.MBProgressHUD

作者 Matej Bukovinski 是一位全栈工程师, UI/UX 设计师, 此项目是一款提示框第三方库, 帮助开发者快速应用到项目中。

先导入MBProgressHUD.h .m导入工程,声明MBProgressHUDDelegate


{

MBProgressHUD*HUD;

}

//initWithView

HUD= [[MBProgressHUDalloc]initWithView:self.navigationController.view];

HUD.delegate = self;

[self.navigationController.view addSubview:HUD];

//小菊花

HUD.delegate=self;

[HUD showWhileExecuting:@selector(XXXX) onTarget:self withObject:nil animated:YES];

//Determinate Mode

HUD.mode=MBProgressHUDModeAnnularDeterminate;

HUD.delegate=self;

HUD.labelText=@"Loading";

[HUD  showWhileExecuting:@selector(myProgressTask)onTarget:self withObject:nil animated:YES];

//Dim background

HUD.dimBackground=YES;

只是简单的写几种常用,具体用找带的 Demo 就好,用完时候实现一下


- (void)hudWasHidden:(MBProgressHUD*)hud {

[HUD removeFromSuperview];

HUD=nil;

}


就 ok 了


2.SVProgressHUD

又一款轻量级的 iOS 第三方控件, 用于显示任务加载时的动画, 非常轻便, 容易使用.

这个更加轻量级了,拖入工程就好


//感叹号

[SVProgressHUD showInfoWithStatus:@"xxxxx."];

//success

[SVProgressHUD showSuccessWithStatus:@"Success!"];

//error

[SVProgressHUD showErrorWithStatus:@"Error"];

个人一般就用这三个,配合大量数据请求的话还是用 MB,个人看法。



0 0
原创粉丝点击