Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 294ca50

Browse files
committed
bug修复
1 parent bbce7b9 commit 294ca50

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

‎.DS_Store

0 Bytes
Binary file not shown.

‎MYCoreText_Example/MYCoreTextLabel/MYCoreTextLabel.m

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ - (void)setText:(NSString *)text linkRanges:(NSArray<NSValue *> *) ranges keywor
180180
- (void)render
181181
{
182182
//属性矫正
183-
[self judge];
183+
if (![self judge]) return;
184184
//复用处理
185185
[self reuseHandle];
186186
[self configAttribute:_text];
@@ -510,14 +510,12 @@ - (void)keyWord:(NSMutableAttributedString *)attributeStr
510510
}
511511

512512
#pragma mark - 判断属性
513-
- (void)judge
513+
- (BOOL)judge
514514
{
515515

516516
if (!_text.length) {
517-
_text = @" ";
518-
return;
517+
return NO;
519518
}
520-
521519
//文本内容
522520
if (!_textFont) _textFont = [UIFont systemFontOfSize:14.f];
523521
if (!_textColor) _textColor = [UIColor blackColor];
@@ -559,13 +557,14 @@ - (void)judge
559557
if (!_keywordFont) _keywordFont = _textFont;
560558
if (!_keyWordColor) _keyWordColor = [UIColor blackColor];
561559
if (!_keyWordBackColor) _keyWordBackColor = [UIColor yellowColor];
560+
return YES;
562561
}
563562

564563
#pragma mark - 计算尺寸
565564
- (CGSize)sizeThatFits:(CGSize)size
566565
{
567-
if (!self.contentTextView.attributedText.length) {
568-
return CGSizeZero;
566+
if (!self.contentTextView.attributedText.length||!_text.length) {
567+
return CGSizeMake(0,0);
569568
}
570569
CGSize viewSize = [self.contentTextView sizeThatFits:CGSizeMake(size.width, size.height)];
571570
return viewSize;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /