MBProgressHUD to show label text in more than one line(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.
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 在多行中显示标签文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:MBProgressHUD 在多行中显示标签文本


基础教程推荐
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01