ios toast提示框(MBProgressHUD)

MBProgressHUD是一个开源项目,实现了不少种样式的提示框android

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

运行效果以下 和android toast 相似github

-(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;
    }];
    
}


相关文章
相关标签/搜索