ios toast提示框(MBProgressHUD)

MBProgressHUD是一个开源项目,实现了很多种样式的提示框

https://github.com/jdg/MBProgressHUD,下载下来后直接把MBProgressHUD.h和MBProgressHUD.m加入即可。

运行效果如下 和android toast 类似

-(void)showAllTextDialog:(NSString *)str {     HUD = [[MBProgressHUD alloc] initWithView:self.view];     [self.view addSubview:HUD];     HUD.labelText = str;     HUD.mode = MBProgressHUDModeText;          //指定距离中心点的X轴和Y轴的位置,不指定则在屏幕中间显示     //    HUD.yOffset = 100.0f;     //    HUD.xOffset = 100.0f;          [HUD showAnimated:YES whileExecutingBlock:^{         sleep(1);     } completionBlock:^{         [HUD removeFromSuperview]; //        [HUD release];         HUD = nil;     }];      }

 

技术分享