MBProgressHUD是一个开源项目,实现了很多种样式的提示框
https://github.com/jdg/MBProgressHUD,下载下来后直接把MBProgressHUD.h和MBProgressHUD.m加入即可。
运行效果如下 和android toast 类似
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
-(
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;
}];
}
|