diff --git a/RTLabelProject/Classes/RTLabel.m b/RTLabelProject/Classes/RTLabel.m
index 4cf8624..798d2a6 100755
--- a/RTLabelProject/Classes/RTLabel.m
+++ b/RTLabelProject/Classes/RTLabel.m
@@ -765,14 +765,14 @@ - (void)setHighlighted:(BOOL)highlighted
- (void)setHighlightedText:(NSString *)text
{
- _highlightedText = [text stringByReplacingOccurrencesOfString:@"
" withString:@"\n"];
+ _highlightedText = [self replaceLineBreakTag:text];
RTLabelExtractedComponent *component = [RTLabel extractTextStyleFromText:_highlightedText paragraphReplacement:self.paragraphReplacement];
[self setHighlightedTextComponents:component.textComponents];
}
- (void)setText:(NSString *)text
{
- _text = [text stringByReplacingOccurrencesOfString:@"
" withString:@"\n"];
+ _text = [self replaceLineBreakTag:text];
RTLabelExtractedComponent *component = [RTLabel extractTextStyleFromText:_text paragraphReplacement:self.paragraphReplacement];
[self setTextComponents:component.textComponents];
[self setPlainText:component.plainText];
@@ -781,7 +781,7 @@ - (void)setText:(NSString *)text
- (void)setText:(NSString *)text extractedTextComponent:(RTLabelExtractedComponent*)extractedComponent
{
- _text = [text stringByReplacingOccurrencesOfString:@"
" withString:@"\n"];
+ _text = [self replaceLineBreakTag:text];
[self setTextComponents:extractedComponent.textComponents];
[self setPlainText:extractedComponent.plainText];
[self setNeedsDisplay];
@@ -789,7 +789,7 @@ - (void)setText:(NSString *)text extractedTextComponent:(RTLabelExtractedCompone
- (void)setHighlightedText:(NSString *)text extractedTextComponent:(RTLabelExtractedComponent*)extractedComponent
{
- _highlightedText = [text stringByReplacingOccurrencesOfString:@"
" withString:@"\n"];
+ _highlightedText = [self replaceLineBreakTag:text];
[self setHighlightedTextComponents:extractedComponent.textComponents];
}
@@ -1063,11 +1063,17 @@ - (NSString*)visibleText
return text;
}
+- (NSString *)replaceLineBreakTag:(NSString *)text {
+ text = [text stringByReplacingOccurrencesOfString:@"
" withString:@"\n"];
+ text = [text stringByReplacingOccurrencesOfString:@"
" withString:@"\n"];
+ return text;
+}
+
#pragma mark deprecated methods
- (void)setText:(NSString *)text extractedTextStyle:(NSDictionary*)extractTextStyle
{
- _text = [text stringByReplacingOccurrencesOfString:@"
" withString:@"\n"];
+ _text = [self replaceLineBreakTag:text];
[self setTextComponents:[extractTextStyle objectForKey:@"textComponents"]];
[self setPlainText:[extractTextStyle objectForKey:@"plainText"]];
[self setNeedsDisplay];