I have UILabelwhose property textI would like to set paragraphs of text to use NSString.
I have an array in which I store a sequence of characters that represent a text paragraph.
The paragraph should not fully comply / include in this UILabel. If the paragraph does not end, I will move on to the next shortcut.
Say, if I had the rectangular size of this UILabel160 X 240, how could I determine the correct font size to fill this line well UILabel?
Is there a mathematical way to calculate the font size based on the size of the rectangle on the screen?
For instance:
UILabel *aLabel = [[UIlabel alloc] initwithFrame(CGRect){{0, 0}, 160, 240}];
aLabel.font = [UIFont fontWithName:@"Courier New" size:<???>];
NSMutableString *aString = [[NSMutableString alloc] init];
int index = 0;
for(int x = 0; x < 240; x+=<???>)
{
for(int y = 0; y < 160; y+=<???>)
{
[aString appendWithString:[paragraphArray objectAtIndex:index]];
index++;
}
[aString appendWithString:@\n"]; //line break
}
aLabel.text = aString;
, ??? ( , for)?
, , .