问题描述
您好,我的 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.
Please Wait.
1-2 Minutes"];
NSLog(@"the loading text will be %@",strloadingText);
self.hud.labelText = strloadingText;
[self.hud show:YES];
所以我想要 3 行中的标签
So i want the label in 3 lines
加载数据.
请稍候
1-2 分钟
或我可以将图像分配给 HUD 吗?
OR can i assign an image to the HUD?
所有这些都应该在标签文本中.但我最终只有一行.我怎样才能做到这一点?如果您需要更多信息,请询问.谢谢.
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.
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 在多行中显示标签文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!