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

网络图片是如何加载的? #2

Open
sunchengs opened this issue Jan 19, 2018 · 6 comments
Open

网络图片是如何加载的? #2

sunchengs opened this issue Jan 19, 2018 · 6 comments

Comments

@sunchengs
Copy link

No description provided.

@hardman
Copy link
Owner

hardman commented Jan 19, 2018

网络图片可以使用UIImageView加载,然后将UIImageView放到富文本中;
也可以提前加载好图片,再创建富文本;
还可以创建好富文本之后,先显示其他部分,图片下载完修改imageComponent后,会自动更新。

@songqingcool
Copy link

实际应用有时候会子线程创建NSAttributeString,异步加载快速显示,因为主线程加载会大量计算出现主线程卡顿,尤其复杂的类朋友圈页面,所以我感觉使用UIImageView显示图片并不会太好。

@songqingcool
Copy link

songqingcool commented Jan 24, 2018

子线程不能创建UIImageview这样的控件。但是由此又会产生一个问题,gif展示在iOS必然要用UIImageView这样的控件

@songqingcool
Copy link

大概看了看你的代码,感觉还是有很多问题。CTFrameRef这种东西,一般来说是可以复用的,比如对于同一个NSAttributeString,计算label高度和展示label内容完全可以用同一个CTFrameRef。

@songqingcool
Copy link

我也在尝试实现类似的Label,只是我们的app实际业务场景遇到了一些比较不容易实现的原因,所以一直也没做出来

@hardman
Copy link
Owner

hardman commented Jan 24, 2018

嗯,demo里有子线程创建 AttributedString同时主线程创建UIView的例子。可以看一下demo中的ChatView。
你说的CTFrameRef复用的问题,我尽快尝试修改。

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

3 participants