I have UILabel in my View that should resize itself based on the content, but it doesn't do so. I have multiline content in it. I tried [label sizeToFit]
+ label.numberOfLines= 0
.
I don't have constraints for the UILabel.
I also tried to use UITextView instead, but there the font just stays on 13 and not as I want on 17. Can you help me?
This is the code that works now:
UILabel *textLabel2 = [[UILabel alloc] initWithFrame:CGRectMake(20, 158, self.view.bounds.size.width-40, 550)];
textLabel2.text = textString;
textLabel2.font = [UIFont fontWithName:@"Helvetica Neue" size:17];
textLabel2.numberOfLines = 0;
[textLabel2 sizeToFit];
[self.scroller addSubview:textLabel2];