CocoaPods trunk is moving to be read-only. Read more on the blog, there are 12 months to go.

DSInsetLabel 0.1.0

DSInsetLabel 0.1.0

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Jun 2015

Maintained by Thomas Baastrup Jacobsen.



Overview

Simple UILabel subclass to use padding insets and max width.

  • 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.

Usage

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;

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

DSInsetLabel is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "DSInsetLabel"

Author

Thomas Baastrup Jacobsen, [email protected]

License

DSInsetLabel is available under the MIT license. See the LICENSE file for more info.