iOS开发精选iOS 开源库问题Obj-C

MBProgressHud 自动换行

2017-04-20  本文已影响154人  韦德460
单行显示 多行显示

使用 **label不会自动换行
使用 detailsLabel 会自动换行

void showMessage(NSString* message)
{
    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:[UIApplication sharedApplication].keyWindow animated:YES];
    
    hud.mode = MBProgressHUDModeText;
    //  hud.label.text = message;
    hud.detailsLabel.text = message;
    hud.bezelView.backgroundColor = [UIColor blackColor];
    //  hud.label.textColor = [UIColor whiteColor];
    hud.detailsLabel.textColor = [UIColor whiteColor];
    if (IS_SCREEN_4_INCH) {
    //  hud.label.font = [UIFont systemFontOfSize:13];
        hud.detailsLabel.font = [UIFont systemFontOfSize:13];
    }
    else if (IS_SCREEN_47_INCH) {
    //  hud.label.font = [UIFont systemFontOfSize:15];
        hud.detailsLabel.font = [UIFont systemFontOfSize:15];
    }
    else {
    //  hud.label.font = [UIFont systemFontOfSize:16];
        hud.detailsLabel.font = [UIFont systemFontOfSize:16];
    }

    dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), ^
    {
        [NSThread sleepForTimeInterval:SVProgressHUDDismissTime];
        dispatch_async(dispatch_get_main_queue(), ^{
            [hud hideAnimated:YES];
        });
    });
}


强烈推荐:超简单!!! iOS设置状态栏、导航栏按钮、标题、颜色、透明度,偏移等

https://github.com/wangrui460/WRNavigationBar
https://github.com/wangrui460/WRNavigationBar_swift



欢迎关注我的微博:wangrui460

上一篇下一篇

猜你喜欢

热点阅读