1+ using Cirrious . FluentLayouts . Touch ;
2+ using Foundation ;
3+ using MvvmCross . iOS . Views ;
4+ using QuickLayout . Core . ViewModels ;
5+ using UIKit ;
6+
7+ namespace QuickLayout . Touch . Views
8+ {
9+ [ Register ( "ToCenterConstraintsView" ) ]
10+ public class ToCenterConstraintsView : MvxViewController < ToCenterConstraintsViewModel >
11+ {
12+ public override void ViewDidLoad ( )
13+ {
14+
15+ UIView firstContainer = new UIView
16+ {
17+ TranslatesAutoresizingMaskIntoConstraints = false ,
18+ BackgroundColor = UIColor . Blue
19+ } ,
20+
21+ secondContainer = new UIView
22+ {
23+ TranslatesAutoresizingMaskIntoConstraints = false ,
24+ BackgroundColor = UIColor . Red
25+ } ,
26+
27+ thirdContainer = new UIView
28+ {
29+ TranslatesAutoresizingMaskIntoConstraints = false ,
30+ BackgroundColor = UIColor . Yellow ,
31+ Alpha = .5f
32+ } ;
33+
34+ View . AddSubviews ( firstContainer , secondContainer , thirdContainer ) ;
35+
36+ View . AddConstraints ( new FluentLayout [ ]
37+ {
38+ firstContainer . AtTopOf ( View ) ,
39+ firstContainer . AtLeftOf ( View ) ,
40+ firstContainer . AboveCenterOf ( View , 10f ) ,
41+ firstContainer . ToLeftOfCenterOf ( View , 10f ) ,
42+
43+ secondContainer . AtBottomOf ( View ) ,
44+ secondContainer . AtRightOf ( View ) ,
45+ secondContainer . ToRightOfCenterOf ( View , 10f ) ,
46+ secondContainer . BelowCenterOf ( View , 10f ) ,
47+
48+ thirdContainer . ToRightOfCenterOf ( firstContainer ) ,
49+ thirdContainer . ToLeftOfCenterOf ( secondContainer ) ,
50+ thirdContainer . AboveCenterOf ( secondContainer ) ,
51+ thirdContainer . BelowCenterOf ( firstContainer )
52+ } ) ;
53+ }
54+ }
55+ }
0 commit comments