youngsoft / TangramKit

TangramKit is a powerful iOS UI framework implemented by Swift. It integrates the functions with Android layout,iOS AutoLayout,SizeClass, HTML CSS float and flexbox and bootstrap. So you can use LinearLayout,RelativeLayout,FrameLayout,TableLayout,FlowLayout,FloatLayout,LayoutSizeClass to build your App 自动布局 UIView UITableView UICollectionView
MIT License
1.21k stars 175 forks source link

为什么蓝色和红色View的高度不一致? #7

Closed roshanman closed 7 years ago

roshanman commented 7 years ago
override func viewDidLoad() {
        super.viewDidLoad()

        let S = TGRelativeLayout()
        let A = UILabel()
        let B = UILabel()

        S.tg_width.equal(300).and().tg_height.equal(300)

        S.backgroundColor = .yellow

        A.text = "Hello world"
        A.backgroundColor = .blue

        A.tg_left.equal(0)
        A.tg_top.equal(0)
        A.tg_height.equal(40)
        A.tg_right.equal(B.tg_left).offset(10)

        B.text = "Hello world2"
        B.backgroundColor = .red

        B.tg_right.equal(0)
        B.tg_top.equal(0)
        B.tg_width.equal(.wrap)
        B.tg_height.equal(40)

         S.addSubview(A)
        S.addSubview(B)

        view.addSubview(S)
    }
2017-01-13 14 30 34

我设置了相同的高度了

A.tg_height.equal(40)
B.tg_height.equal(40)
youngsoft commented 7 years ago

谢谢你的问题,我已经修复了这个BUG了。这个BUG是因为以前认为宽度是wrap高度是特定值是不可能的情况!!其实是有可能的。您可以下载最新的git代码。。后续我会在版本升级中加上changelog.