MBProgressHUD以多行显示标签文本 [英] MBProgressHUD to show label text in more than one line

查看:493
本文介绍了MBProgressHUD以多行显示标签文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的iPad屏幕上有一个MBProgressHUD。工作得很好。但是我想将标签改为三行显示。就像这样

Hi i have a MBProgressHUD on my iPad screen. Works perfectly fine. But i want to change the label to show in three lines.Like this

    self.hud =  [[MBProgressHUD alloc] initWithView:self.navigationController.view];  
self.hud.frame = CGRectMake(0, 0, 120, 143);

[self.navigationController.view addSubview:self.hud];
self.hud.delegate = self;
self.hud.mode = MBProgressHUDModeAnnularDeterminate;
NSString *strloadingText = [NSString stringWithFormat:@"Loading Data.\r Please Wait.\r 1-2 Minutes"];
NSLog(@"the loading text will be %@",strloadingText);
self.hud.labelText = strloadingText;
[self.hud show:YES];

所以我想要3行标签

正在加载数据。

请等待

1-2分钟

OR
我可以将图像分配给HUD吗?

OR can i assign an image to the HUD?

所有这些都应该在labeltext中。但我最终只有一条线。我怎样才能做到这一点?
如果您需要更多信息,请询问。谢谢。

All this should be in the labeltext. But i am ending up with only one line. How can i do that? If you need more info, please ask.Thanks.

推荐答案

MBProgressHUD的detailsLabelText属性是多行但不是labelText属性。

MBProgressHUD's detailsLabelText property is multiline but not labelText property.

所以,你可以尝试这样的事情

So, you can try something like this

MBProgressHUD * hud =  [MBProgressHUD showHUDAddedTo:self.view animated:YES];
hud.frame = CGRectMake(0, 0, 120, 143);

hud.mode = MBProgressHUDModeAnnularDeterminate;
NSString *strloadingText = [NSString stringWithFormat:@"Loading Data."];
NSString *strloadingText2 = [NSString stringWithFormat:@" Please Wait.\r 1-2 Minutes"];

NSLog(@"the loading text will be %@",strloadingText);
hud.labelText = strloadingText;
hud.detailsLabelText=strloadingText2;

您可以使用属性detailsLabelFont设置detailsLabelText字体。

You can set detailsLabelText font by using the property detailsLabelFont.

这篇关于MBProgressHUD以多行显示标签文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆