ec

ESAdjustableLabel-Category

This category implements some basic methods to modify the dimensions of a given UILabel

Showing:

Popularity

Downloads/wk

0

GitHub Stars

76

Maintenance

Last Commit

9yrs ago

Contributors

1

Package

Dependencies

0

License

none specified

Categories

Readme

#ESAdjustable Label Category

Adjusting the size of a UILabel is a pain in the back. This category provides a couple of simple methods to make this process less painful:

// Generic method. If minSize is set to CGSizeZero then
// it is ignored
// =====================================================
- (void)adjustLabelToMaximumSize:(CGSize)maxSize 
                     minimumSize:(CGSize)minSize 
                 minimumFontSize:(int)minFontSize;

// Adjust label using only the maximum size and the 
// font size as constraints
// =====================================================
- (void)adjustLabelToMaximumSize:(CGSize)maxSize 
                 minimumFontSize:(int)minFontSize;

// Adjust the size of the label using only the font
// size as a constraint (the maximum size will be
// calculated automatically based on the screen size)
// =====================================================
- (void)adjustLabelSizeWithMinimumFontSize:(int)minFontSize;

// Adjust label without any constraints (the maximum 
// size will be calculated automatically based on the
// screen size)
// =====================================================
- (void)adjustLabel;

This repo includes a sample demo that illustrates how to use this category.

How to use it in your projects

  1. Copy the two category files below into your project
  • UILabel+ESAdjustableLabel.h
  • UILabel+ESAdjustableLabel.m
  1. Add the following line of code in the header file of the class where the UILabel you need to modify its size is located:
#import "UILabel+ESAdjustableLabel.h"

Happy hacking ;)

-Edgar

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100