0

There's an option in StoryBoard to set the Preferred Width to automatic enter image description here

How can this be achieved programmatically? I know that UILabel has a preferredMaxLayoutWidth property, but how can I set to automatic?

Quantaliinuxite
  • 3,133
  • 4
  • 18
  • 32

1 Answers1

-1

there is a property in UILabel class

// Support for constraint-based layout (auto layout)
// If nonzero, this is used when determining -intrinsicContentSize for multiline labels
@property(nonatomic) CGFloat preferredMaxLayoutWidth NS_AVAILABLE_IOS(6_0);

if you will not set it will set automatically by default

techloverr
  • 2,597
  • 1
  • 16
  • 28