Tag Archive for 'uilabel'

Sizing labels with -[NSString sizeWithFont:…] – WRONG

Right:

CGSize maxSize = CGSizeMake(200.0f, CGFLOAT_MAX);
CGSize requiredSize = [label sizeThatFits:maxSize];
label.frame = CGRectMake(10, 10, size.width, size.height);

More details

Vertical align text to top of UILabel

The iOS UIKit does not provide the possibility to vertically align text in an UILabel frame, however there is a solution, to align text to the top of the label. To fix the problem, visit Stackoverflow.com.