Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/edgarschmidt/ESAdjustableLabel-Category
This category implements some basic methods to modify the dimensions of a given UILabel
https://github.com/edgarschmidt/ESAdjustableLabel-Category
Last synced: 2 months ago
JSON representation
This category implements some basic methods to modify the dimensions of a given UILabel
- Host: GitHub
- URL: https://github.com/edgarschmidt/ESAdjustableLabel-Category
- Owner: edgarschmidt
- Created: 2012-04-15T00:11:10.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2017-04-18T03:41:41.000Z (over 7 years ago)
- Last Synced: 2024-10-31T15:57:34.753Z (2 months ago)
- Language: Objective-C
- Homepage:
- Size: 135 KB
- Stars: 75
- Watchers: 3
- Forks: 8
- Open Issues: 3
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
- awesome - ESAdjustableLabel-Category - This category implements some basic methods to modify the dimensions of a given UILabel (etc)
- awesome - ESAdjustableLabel-Category - This category implements some basic methods to modify the dimensions of a given UILabel (etc)
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:
```objc
// 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
2. Add the following line of code in the header file of the class where the UILabel you need to modify its size is located:```objc
#import "UILabel+ESAdjustableLabel.h"
```Happy hacking ;)
-Edgar