Skip to content

Instantly share code, notes, and snippets.

@centwave
Created June 26, 2013 10:14
Show Gist options
  • Save centwave/5866349 to your computer and use it in GitHub Desktop.
Save centwave/5866349 to your computer and use it in GitHub Desktop.
Make UILabel text always stay on top of the frame
CGSize textSize = [label.text sizeWithFont:label.font
constrainedToSize:CGSizeMake(label.frame.size.width, MAXFLOAT)
lineBreakMode:label.lineBreakMode];
label.frame = (CGRect){.origin=label.origin,.size={ceilf(textSize.width), ceilf(textSize.height)}}};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment