You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
890 B
44 lines
890 B
1 year ago
|
//
|
||
|
// MyUILabel.m
|
||
|
// tongxin
|
||
|
//
|
||
|
// Created by ecell on 2021/6/9.
|
||
|
// Copyright © 2021 xTT. All rights reserved.
|
||
|
//
|
||
|
|
||
|
#import "MyUILabel.h"
|
||
|
|
||
|
@implementation MyUILabel
|
||
|
|
||
|
/*
|
||
|
// Only override drawRect: if you perform custom drawing.
|
||
|
// An empty implementation adversely affects performance during animation.
|
||
|
- (void)drawRect:(CGRect)rect {
|
||
|
// Drawing code
|
||
|
}
|
||
|
*/
|
||
|
|
||
|
- (id)initWithFrame:(CGRect)frame{
|
||
|
self = [super initWithFrame:frame];
|
||
|
if (self) {
|
||
|
//self.edgeInsets = UIEdgeInsetsMake(0, 6, 0, 6);
|
||
|
}
|
||
|
return self;
|
||
|
}
|
||
|
|
||
|
- (void)drawTextInRect:(CGRect)rect
|
||
|
{
|
||
|
[super drawTextInRect:UIEdgeInsetsInsetRect(rect, self.edgeInsets)];
|
||
|
}
|
||
|
|
||
|
- (CGSize)intrinsicContentSize
|
||
|
{
|
||
|
CGSize size = [super intrinsicContentSize];
|
||
|
size.width += self.edgeInsets.left + self.edgeInsets.right;
|
||
|
size.height += self.edgeInsets.top + self.edgeInsets.bottom;
|
||
|
return size;
|
||
|
}
|
||
|
|
||
|
|
||
|
@end
|