- The DSInsetLabel will let you set padding insets and resize the label while respecting the insets.
- You also have the option of setting a max width on the label that will also respect the insets.
Standard use with [sizeToFit]
:
DSInsetLabel *myLabel = [DSInsetLabel new];
myLabel.edgeInsets = UIEdgeInsetsMake(10, 15, 10, 15);
myLabel.text = @"My text";
[myLabel sizeToFit];
[self.view addSubview:myLabel];
To limit the width of the label just set the maxWidth property:
myLabel.maxWidth = 200;
To run the example project, clone the repo, and run pod install
from the Example directory first.
DSInsetLabel is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "DSInsetLabel"
Thomas Baastrup Jacobsen, [email protected]
DSInsetLabel is available under the MIT license. See the LICENSE file for more info.