Comments (7)
我测试了 可以 没问题 我已经更新demo 里面有使用xib的autolayout来创建label
from tyattributedlabel.
用直接赋值label.text=text的方法可以,但是用textContainer的方法就不行了
from tyattributedlabel.
你是在cell中使用吗
from tyattributedlabel.
可以贴出代码吗
from tyattributedlabel.
对的在cell上使用,
label.numberOfLines = 1;
label.lineBreakMode = kCTLineBreakByTruncatingTail;
NSString *text = @"我是一段很长的文字来的,哈哈哈哈,真的很长,十分长的啊,为什么会这样子的呢?"
label.text = text;
但是如果使用TYTextContainer就不行了
TYTextContainer *textContainer = [[TYTextContainer alloc]init];
textContainer.text = text;
TYTextStorage *textStorage = [[TYTextStorage alloc]init];
textStorage.range = [_result.subject rangeOfString:@"哈哈"];
textStorage.textColor = RGBCOLOR(235, 26, 91);
[textContainer addTextStorage:textStorage];
label.textContainer = textContainer;
因为我需要用到一些其他的样式所以只能用TYTextContainer
from tyattributedlabel.
你要在textContainer 设置 numberOfLines lineBreakMode 因为textContainer会覆盖label的
from tyattributedlabel.
好的,可以了,谢谢!以为设置了label就可以了。
from tyattributedlabel.
Related Issues (20)
- 如何在图文混排的时候实现炫彩文字
- 支持swift吗
- addAttributeCharacterSpacing and addAttributeAlignmentStyle function did not work
- 你好, 请问怎么很好的调整绘制区域
- 追加view没有上下居中
- appendLinkWithText
- 如何添加长按菜单
- 可否修改一下警告
- "آٍٍٍَّ🇮🇹 بٍٍٍٍََِّ"显示这个文字时会崩溃
- xcode 12 beta 6 BUILD 失敗 HOT 16
- Incompatible block pointer types sending 'void (^__strong)(__strong id<TYLinkStorageProtocol>)' to parameter of type 'void (^)(__strong id<TYTextStorageProtocol>)' HOT 2
- pod 'TYAttributedLabel', '~> 2.6.2' 无法更新到最新修改 HOT 1
- 更新XCode12之后,编译报错 HOT 5
- 严重BUG HOT 2
- 下载zip下来解压不了啊
- 你好我在使用- (void)appendView:(UIView *)view;- (void)appendText:(NSString *)text;时遇到了问题。
- 你好
- 如何在同一个地方添加多个TYImageStorage
- 全文收起功能代理不走
- 这项目是已经不维护了吗? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tyattributedlabel.