tags:

views:

130

answers:

0

I found this post for aligning a text label top that was very helpful.

- (void)sizeToFitFixedWidth:(NSInteger)fixedWidth
{
    self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, fixedWidth, 0);
    self.lineBreakMode = UILineBreakModeWordWrap;
    self.numberOfLines = 0;
    [self sizeToFit];
}

Is there a way to extend this to:

  1. Set a max pixel height or number of rows for the label
  2. Get the label to respect the Line Breaks: Truncate Tail setting as found in Interface Builder.

Thanks for sharing.