Created
August 19, 2015 07:07
-
-
Save funkydevil/ac90b913d03698674ef3 to your computer and use it in GitHub Desktop.
UILabel with paddings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Created by Kirill Pyulzyu on 19.08.15. | |
// Copyright (c) 2015 Kirill Pyulzyu. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
@interface UILabelWithInsets : UILabel | |
@property (nonatomic) CGFloat topInset; | |
@property (nonatomic) CGFloat leftInset; | |
@property (nonatomic) CGFloat bottomInset; | |
@property (nonatomic) CGFloat rightInset; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Created by Kirill Pyulzyu on 19.08.15. | |
// Copyright (c) 2015 Kirill Pyulzyu. All rights reserved. | |
// | |
#import "UILabelWithInsets.h" | |
@implementation UILabelWithInsets | |
{ | |
} | |
- (void)drawTextInRect:(CGRect)rect | |
{ | |
UIEdgeInsets insets = {self.topInset, self.leftInset, | |
self.bottomInset, self.rightInset}; | |
return [super drawTextInRect:UIEdgeInsetsInsetRect(rect, insets)]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment