iOS:fix text cannot apply padding properly

This commit is contained in:
pengfei.zhou 2020-03-13 16:24:00 +08:00 committed by osborn
parent c1f4805444
commit 6cf0f4603e

View File

@ -25,9 +25,19 @@
#import "DoricGroupNode.h"
#import "Doric.h"
@interface DoricTextView : UILabel
@end
@implementation DoricTextView
- (void)drawTextInRect:(CGRect)rect {
[super drawTextInRect:UIEdgeInsetsInsetRect(rect, self.padding)];
}
@end
@implementation DoricTextNode
- (UILabel *)build {
return [[[UILabel alloc] init] also:^(UILabel *it) {
return [[[DoricTextView alloc] init] also:^(UILabel *it) {
it.textAlignment = NSTextAlignmentCenter;
}];
}