HUD with multiple lines

How can I make a HUD with multiple lines? It is my code, but labelText is one line

HUD = [MBProgressHUD showHUDAddedTo:[[TTNavigator navigator] window] animated:YES]; HUD.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"noImage.png"]]; HUD.mode = MBProgressHUDModeCustomView; HUD.delegate = self; HUD.labelText = @"text1 \n text2"; [HUD hide:YES afterDelay:3]; 
+6
source share
3 answers

use the detailLabelText method, i.e.

 HUD.detailsLabelText = @"your next line here" 

you can change the style with detailsLabelFont.

+14
source

The easiest way (extending John Madison's answer):

 hud.labelText = @"Your first line of text is"; hud.detailsLabelText = @"followed by your next line of text"; hud.detailsLabelFont = hud.labelFont; 
+6
source

Not sure, but you need to change the code of the MBProgressHUD.m file.

In the MBProgressHUD.m file there is a method - (void)setupLabels . This method creates a label. Make this label a multi-line label by setting its numberOfLines property.

Example:

label.numberOfLines = 2;

Hope this works.

+2
source

Source: https://habr.com/ru/post/922701/


All Articles