Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在MLLabelTextStorage里崩溃 #4

Closed
sablib opened this issue Aug 26, 2015 · 8 comments
Closed

在MLLabelTextStorage里崩溃 #4

sablib opened this issue Aug 26, 2015 · 8 comments

Comments

@sablib
Copy link

sablib commented Aug 26, 2015

使用过程中经常在MLLabelTextStorage调用setAttributedString:的时候崩溃。

- (void)replaceCharactersInRange:(NSRange)range withString:(NSString *)str;
- (void)setAttributes:(NSDictionary *)attrs range:(NSRange)range
- (NSDictionary *)attributesAtIndex:(NSUInteger)location effectiveRange:(NSRangePointer)range

这几个方法里面都有崩溃过。

看代码里面MLLabelTextStorage其实是没有做什么工作的,如果在代码里把它给去掉,使用NSTextStorage应该是没有问题的吧?

@sablib
Copy link
Author

sablib commented Aug 26, 2015

image

@sablib
Copy link
Author

sablib commented Aug 26, 2015

尝试了一下NSTextStorage依然有崩溃。

@molon
Copy link
Owner

molon commented Aug 26, 2015

@sablib 可否麻烦提供个代码例子。 扣扣 瑶瑶其三儿儿而思儿

@sablib
Copy link
Author

sablib commented Aug 26, 2015

@molon 这个不怎么好重现,我今天跑的时候,有时候几次就出现了,有时候几十次都不一定会出现。

会不会是因为这里执行的时候没有在主线程上面?

@molon
Copy link
Owner

molon commented Aug 26, 2015

@sablib 我这东西还是跑在主线程吧,不是主线程的话估计会有问题。你这边能确定出现这情况都是在非主线程么?

@sablib
Copy link
Author

sablib commented Aug 26, 2015

@molon 这里的执行,算高的时候都不在主线程,显示的时候在主线程。
可以确定出问题的时候都是在非主线程上面。

@molon
Copy link
Owner

molon commented Aug 26, 2015

@sablib 嗯,了解了。很抱歉,算高支持非主线程有点难度。 一般我都是懒加载条数少点,并且对row记录高度防止重复计算来提高性能的。 虽然不极致,但是一般用起来是没有啥问题啦。 :)

@molon molon closed this as completed Aug 26, 2015
@sablib
Copy link
Author

sablib commented Aug 26, 2015

@molon 多谢哈!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants