예제 #1
0
        public override void ViewDidLayoutSubviews()
        {
            base.ViewDidLayoutSubviews();

            nfloat yTop = 0;

            if (UIDevice.CurrentDevice.CheckSystemVersion(7, 0))
            {
                yTop = TopLayoutGuide.Length;
            }

            const int margin = 10;

            View.AddConstraints(
                _keyLabel.AtLeftOf(View, margin),
                _keyLabel.AtRightOf(View, margin),
                _keyLabel.AtTopOf(View, yTop + margin),

                _key.WithSameLeft(_keyLabel),
                _key.WithSameRight(_keyLabel),
                _key.Below(_keyLabel, margin),

                _valueLabel.WithSameLeft(_key),
                _valueLabel.WithSameRight(_key),
                _valueLabel.Below(_key, margin),

                _value.WithSameLeft(_valueLabel),
                _value.WithSameRight(_valueLabel),
                _value.Below(_valueLabel, margin),

                _boolLabel.WithSameLeft(_keyLabel),
                _boolLabel.Below(_value, margin),

                _boolSwitch.ToRightOf(_boolLabel, margin),
                _boolSwitch.WithSameTop(_boolLabel),

                _restoredBoolLabel.WithSameLeft(_boolLabel),
                _restoredBoolLabel.Below(_boolLabel, margin),

                _restoredBoolValue.ToRightOf(_restoredBoolLabel, margin),
                _restoredBoolValue.WithSameTop(_restoredBoolLabel),

                _saveSetting.WithSameLeft(_value),
                _saveSetting.WithSameRight(_value),
                _saveSetting.Below(_restoredBoolValue, margin),

                _retrieveSetting.WithSameLeft(_saveSetting),
                _retrieveSetting.WithSameRight(_saveSetting),
                _retrieveSetting.Below(_saveSetting, margin)
                );

            View.LayoutSubviews();
        }