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


相關文章
相關標籤/搜索