iOS:fix default gravity to be center

This commit is contained in:
pengfei.zhou 2020-05-06 15:11:01 +08:00 committed by osborn
parent 8db686b89b
commit 931c06393e

View File

@ -49,7 +49,6 @@ @interface DoricTextNode ()
@implementation DoricTextNode @implementation DoricTextNode
- (UILabel *)build { - (UILabel *)build {
return [[[DoricTextView alloc] init] also:^(DoricTextView *it) { return [[[DoricTextView alloc] init] also:^(DoricTextView *it) {
it.textAlignment = NSTextAlignmentCenter;
[self ensureParagraphStyle]; [self ensureParagraphStyle];
}]; }];
} }
@ -163,7 +162,7 @@ - (void)blendView:(UILabel *)view forPropName:(NSString *)name propValue:(id)pro
- (NSMutableParagraphStyle *)ensureParagraphStyle { - (NSMutableParagraphStyle *)ensureParagraphStyle {
if (self.paragraphStyle == nil) { if (self.paragraphStyle == nil) {
self.paragraphStyle = [NSMutableParagraphStyle new]; self.paragraphStyle = [NSMutableParagraphStyle new];
self.paragraphStyle.alignment = self.view.textAlignment; self.paragraphStyle.alignment = NSTextAlignmentCenter;
self.paragraphStyle.lineBreakMode = NSLineBreakByTruncatingTail; self.paragraphStyle.lineBreakMode = NSLineBreakByTruncatingTail;
} }
return self.paragraphStyle; return self.paragraphStyle;