@@ -60,45 +60,49 @@ class TestViewController: UIViewController {
60
60
view1. textAlignment = . Center
61
61
view1. font = UIFont . boldSystemFontOfSize ( 20 )
62
62
view1. textColor = UIColor . whiteColor ( )
63
- anchorViewA . addSubview ( view1)
63
+ view . addSubview ( view1)
64
64
65
65
view2. backgroundColor = UIColor ( red: 132 / 255.0 , green: 169 / 255.0 , blue: 57 / 255.0 , alpha: 1.0 )
66
66
view2. text = " 2 "
67
67
view2. textAlignment = . Center
68
68
view2. font = UIFont . boldSystemFontOfSize ( 20 )
69
69
view2. textColor = UIColor . whiteColor ( )
70
- anchorViewA . addSubview ( view2)
70
+ view . addSubview ( view2)
71
71
72
72
view3. backgroundColor = UIColor ( red: 78 / 255.0 , green: 102 / 255.0 , blue: 131 / 255.0 , alpha: 1.0 )
73
73
view3. text = " 3 "
74
74
view3. textAlignment = . Center
75
75
view3. font = UIFont . boldSystemFontOfSize ( 20 )
76
76
view3. textColor = UIColor . whiteColor ( )
77
- anchorViewA . addSubview ( view3)
77
+ view . addSubview ( view3)
78
78
79
79
view4. backgroundColor = UIColor ( red: 132 / 255.0 , green: 169 / 255.0 , blue: 57 / 255.0 , alpha: 1.0 )
80
80
view4. text = " 4 "
81
81
view4. textAlignment = . Center
82
82
view4. font = UIFont . boldSystemFontOfSize ( 20 )
83
83
view4. textColor = UIColor . whiteColor ( )
84
- anchorViewB . addSubview ( view4)
84
+ view . addSubview ( view4)
85
85
86
86
view5. backgroundColor = UIColor ( red: 78 / 255.0 , green: 102 / 255.0 , blue: 131 / 255.0 , alpha: 1.0 )
87
87
view5. text = " 5 "
88
88
view5. textAlignment = . Center
89
89
view5. font = UIFont . boldSystemFontOfSize ( 20 )
90
90
view5. textColor = UIColor . whiteColor ( )
91
- anchorViewB . addSubview ( view5)
91
+ view . addSubview ( view5)
92
92
93
93
view6. backgroundColor = UIColor ( red: 132 / 255.0 , green: 169 / 255.0 , blue: 57 / 255.0 , alpha: 1.0 )
94
94
view6. text = " 6 "
95
95
view6. textAlignment = . Center
96
96
view6. font = UIFont . boldSystemFontOfSize ( 20 )
97
97
view6. textColor = UIColor . whiteColor ( )
98
- anchorViewB . addSubview ( view6)
98
+ view . addSubview ( view6)
99
99
}
100
100
101
101
override func viewWillLayoutSubviews( ) {
102
102
super. viewWillLayoutSubviews ( )
103
+
104
+ anchorViewA. anchorInCenter ( width: 200 , height: 200 )
105
+ view. groupAndAlign ( group: . Horizontal, andAlign: . ToTheRightMatchingTop, views: [ view1, view2, view3] , relativeTo: anchorViewA, padding: 10 , width: 50 , height: 50 )
106
+ view. groupAndAlign ( group: . Vertical, andAlign: . UnderCentered, views: [ view4, view5, view6] , relativeTo: anchorViewA, padding: 10 , width: 50 , height: 50 )
103
107
}
104
108
}
0 commit comments