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

label的图标问题 #42

Closed
zcgit opened this issue Feb 26, 2014 · 9 comments
Closed

label的图标问题 #42

zcgit opened this issue Feb 26, 2014 · 9 comments

Comments

@zcgit
Copy link
Contributor

zcgit commented Feb 26, 2014

目前label在ios可否将图标和文字的中间部分对齐,目前全部是居下对齐,当图标比较大的时候排版不是很好控制,而且在android上也是这种情况,不能横向居中对齐,目前我想到的是重写ImageSpan,但是效果不理想,而且目前比较严重的就是在ios上设置了w,h或者scale等,显示的效果在android上可能差别很大。

@stubma
Copy link
Owner

stubma commented Feb 26, 2014

嗯, 貌似是在ios上忘了考虑屏幕的retina缩放, 导致ios上有时显示的图标大于android上的, 这是个bug需要改. 至于可以任意对齐, 算是个新功能, 应该可以加

@stubma stubma closed this as completed in fb420d8 Feb 26, 2014
@stubma stubma reopened this Feb 26, 2014
@stubma
Copy link
Owner

stubma commented Feb 26, 2014

现在android和ios上的内嵌图片表现的是一样大了, 测试了contentScaleFactor为1或者不为1的情况, perfect.

@zcgit
Copy link
Contributor Author

zcgit commented Feb 26, 2014

perfect!!!马上测试。

@stubma
Copy link
Owner

stubma commented Feb 26, 2014

任意对齐功能不太好弄, 原因是richlabel支持任意字体, 也就是说一行里可能有多种字体, 这意味着如果要支持任意对齐, 在决定图像位置的时候就必须知道行高, 但是图像大小本身又是可能影响行高的. 这是个死锁的情况了, 除非一行里只有一种字体, 但是对于richlabel来说, 一行里只有一种字体是个不完美的假设. 另外, android和ios对于内嵌图片的渲染时间不同, 也带来了很多麻烦, 所以暂时不打算支持任意对齐.

@stubma stubma closed this as completed Feb 26, 2014
@zcgit
Copy link
Contributor Author

zcgit commented Feb 26, 2014

不过说实话,我们目前一行里有多种字体很少,按百分比来说不到5%,所以咱们可以判断,如果字符串中没有多个size标签,可以支持任意对齐。

@stubma stubma reopened this Feb 26, 2014
@stubma
Copy link
Owner

stubma commented Feb 26, 2014

这种基于一个假设才能做的特性意义不大, 可以用别的方式满足你的需求。可以支持一个offsety属性,表示图像在y轴上的偏移量, 这样也可以满足你的场景,而且不依赖于行高,是更通用的方案。偏移量是相对于baseline的,不管一行有多少字体,baseline都是一样的.

@stubma
Copy link
Owner

stubma commented Feb 27, 2014

目前还有问题, 大小在w, h的时候还是不对, 看起来不应该考虑retina屏幕缩放, 经过测试后, ios已经ok, android有点麻烦, 正在继续调试, 继续等待吧

@zcgit
Copy link
Contributor Author

zcgit commented Feb 28, 2014

嗯,我也测试了,android确实有问题。有scale的时候也是不对。

@stubma stubma closed this as completed in 0e86f52 Feb 28, 2014
@stubma
Copy link
Owner

stubma commented Feb 28, 2014

终于对了, 测试了各种组合情况, 感觉ok了.

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