// // 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