I’m using a UILabel for displaying the user input. If the user input is like “xxxxx xxxx xxxx xxxx xxx xxxx xxx xxx” it is perfectly displayed on the UILabel. But when the input is something like “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx” causes the issue. This text won’t be displayed on the UILabel.
I’m using the following code for the UILabel functionality.
-(void)displayText:(NSString *)text
{
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(75,50,30,50)];
label.text = text;
label.numberOfLines = 10;
label.lineBreakMode = UILineBreakModeWordWrap;
[self.view addSubview:label];
[label release];
}
I have changed the line break mode to UILineBreakModeCharacterWrap,UILineBreakModeClip,UILineBreakModeHeadTruncation,UILineBreakModeTailTruncation and UILineBreakModeMiddleTruncation. But the issue is still there. I know the issue is with the input text with no spaces, but how to fix this. Please help me to find a solution. Thanks in advance.
Your text is bigger than the size of the label, you can either truncate it (head, middle, tail) or you can make the font smaller