cocoaui icon indicating copy to clipboard operation
cocoaui copied to clipboard

1. Fix a bug on IView. 2. Add '-' usage on 'ratioWidth/ratioHeight'

Open TonyJR opened this issue 10 years ago • 4 comments
trafficstars

1.Fix a bug on IView. The error code like this:

2.Add a usage of '-' on 'ratioWidth/ratioHeight' eg.

It's mean the height is 25% of the div width,in order to constraint ratio.

TonyJR avatar Oct 16 '15 07:10 TonyJR

Hi, 能否详细介绍下这个bug? 另外, 你对代码格式和缩进做了不符合规范的改动. 另外, 建议把这个 PR 拆分成多个小的 PR, 每一个只做一个改动.

ideawu avatar Oct 19 '15 03:10 ideawu

Hi,这个bug是这样的。我希望实现的场景是这样的——在一个未知宽度的div中加入了4个子div,每个div的宽度是25%,于是我写了如下一段xml

结果发现第一个div是正确的,占用25%空间。但是从第二个div开始,占用的宽度并不是父级div总宽度的25%,剩余空白空间的25%。 修复这个bug我只修改了IFlowLayout.m文件

另外缩进的问题可能是因为我使用新版本xcode导致的问题,每次拷贝代码都会产生变化。

by: 秦涛 mail: [email protected] phone: 13375313826

在 2015年10月19日,上午11:08,ideawu [email protected] 写道:

Hi, 能否详细介绍下这个bug? 另外, 你对代码格式和缩进做了不符合规范的改动. 另外, 建议把这个 PR 拆分成多个小的 PR, 每一个只做一个改动.

— Reply to this email directly or view it on GitHub https://github.com/ideawu/cocoaui/pull/14#issuecomment-149085020.

TonyJR avatar Oct 19 '15 06:10 TonyJR

这不是bug, 设计如此, 具体看文档: http://www.cocoaui.com/docs/flowlayout

CocoaUI 的宽度百分比和 Web 浏览器中的百分比意义有差异, CocoaUI 是指相对当前空间的百分比, 不是相对父元素. 所以要实现等宽, 第一列是 1/n, 第二列是 1/(n-1)... 最后一列是 1/1, 即 100%.

ideawu avatar Oct 19 '15 06:10 ideawu

关于缩进问题, 你必须修改你的编辑器, 使用和 CocoaUI 风格统一的缩进方式, 即用 TAB 来缩进, 永远不要用空格来缩进.

ideawu avatar Oct 19 '15 06:10 ideawu