Skip to content

Simple UILabel subclass to use padding insets and max width

License

Notifications You must be signed in to change notification settings

thbaja/DSInsetLabel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DSInsetLabel

Version License Platform

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.

About

Simple UILabel subclass to use padding insets and max width

Resources

License

Stars

Watchers

Forks

Packages

No packages published