zoukankan      html  css  js  c++  java
  • MBProgressHUD 的类扩展方法用法

    #import "MBProgressHUD.h"
    
    @interface MBProgressHUD (Add)
    + (void)showError:(NSString *)error toView:(UIView *)view;
    
    + (MBProgressHUD *)showMessag:(NSString *)message toView:(UIView *)view;
    @end
    
    
    #import "MBProgressHUD+Add.h"
    
    @implementation MBProgressHUD (Add)
    #pragma mark 显示错误信息
    + (void)showError:(NSString *)error toView:(UIView *)view{
        // 快速显示一个提示信息
        MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES];
        hud.labelText = error;
        // 设置图片
        hud.customView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"alert_failed_icon.png"]] autorelease];
        // 再设置模式
        hud.mode = MBProgressHUDModeCustomView;
        
        // 隐藏时候从父控件中移除
        hud.removeFromSuperViewOnHide = YES;
        
        // 1秒之后再消失
        [hud hide:YES afterDelay:1];
    }
    
    #pragma mark 显示一些信息
    + (MBProgressHUD *)showMessag:(NSString *)message toView:(UIView *)view {
        // 快速显示一个提示信息
        MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES];
        hud.labelText = message;
        // 隐藏时候从父控件中移除
        hud.removeFromSuperViewOnHide = YES;
        
        // YES代表需要蒙版效果
        hud.dimBackground = YES;
        
        return hud;
    }
    @end
  • 相关阅读:
    Object-C,NSSet,不可变集合
    NYIST 860 又见01背包
    NYIST 1070 诡异的电梯【Ⅰ】
    HDU 1542 Atlantis
    HDU 4756 Install Air Conditioning
    CodeForces 362E Petya and Pipes
    HDU 4751 Divide Groups
    HDU 3081 Marriage Match II
    UVA 11404 Palindromic Subsequence
    UVALIVE 4256 Salesmen
  • 原文地址:https://www.cnblogs.com/gcb999/p/3178732.html
Copyright © 2011-2022 走看看