Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions TYAttributedLabelDemo/TYAttributedLabel/TYViewStorage.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ - (void)drawStorageWithRect:(CGRect)rect
// 设置frame 注意 转换rect CoreText context coordinates are the opposite to UIKit so we flip the bounds
CGAffineTransform transform = CGAffineTransformScale(CGAffineTransformMakeTranslation(0, _superView.bounds.size.height), 1.f, -1.f);
rect = CGRectApplyAffineTransform(rect, transform);

//iOS 9 以上系统兼容 RTL 排版方向
if ([[UIDevice currentDevice].systemVersion floatValue] >= 9.0) {
if (UIUserInterfaceLayoutDirectionRightToLeft == [UIView userInterfaceLayoutDirectionForSemanticContentAttribute:_superView.semanticContentAttribute]) {
rect.origin.x = rect.origin.x - rect.size.width;
}
}

[_view setFrame:rect];
[_superView addSubview:_view];
}
Expand Down