EnkiUtils
Small library of classes that Enki Labs uses internally.
Main Page
Classes
Files
File List
All
Classes
Functions
Properties
Pages
UILabel+EnkiUtils.m
1
//
2
// UILabel+EkniUtils.m
3
//
4
// Copyright (c) 2013 BadPirate
5
//
6
7
#import "UILabel+EnkiUtils.h"
8
9
// Solution from http://stackoverflow.com/questions/406212/sizing-a-uilabel-to-fit
10
// thanks BadPirate
11
//
12
13
@implementation
UILabel (EkniUtils)
14
15
- (void)sizeToFitFixedWidth:(CGFloat)fixedWidth
16
{
17
if
(fixedWidth < 0) {
18
self
.frame = CGRectMake(
self
.frame.origin.x,
self
.frame.origin.y,
self
.frame.size.width, 0);
19
}
else
{
20
self
.frame = CGRectMake(
self
.frame.origin.x,
self
.frame.origin.y, fixedWidth, 0);
21
}
22
self
.lineBreakMode = UILineBreakModeWordWrap;
23
self
.numberOfLines = 0;
24
[
self
sizeToFit];
25
}
26
27
@end
EnkiUtils
src
UILabel+EnkiUtils.m
Generated on Wed May 1 2013 13:51:48 for EnkiUtils by
1.8.2