コード例 #1
0
        private void SetupConstraints()
        {
            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
            ScrollView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
            ContainerView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            View.AddConstraints(
                ContainerView.WithSameWidth(View),
                BackButton.AtTopOf(View, 15),
                BackButton.AtLeftOf(View, 15)
                );

            ScrollView.AddConstraints(
                ContainerView.AtTopOf(ScrollView),
                ContainerView.AtLeftOf(ScrollView),
                ContainerView.AtRightOf(ScrollView),
                ContainerView.AtBottomOf(ScrollView),
                ContainerView.Height().EqualTo(UIScreen.MainScreen.Bounds.Height)
                );

            ContainerView.AddConstraints(
                Logo.AtTopOf(ContainerView, 40),
                Logo.WithSameCenterX(ContainerView),

                Indicator.Below(Logo, 30),
                Indicator.WithSameCenterX(Logo),

                EmailRuler.Above(ResetButton, 0),
                EmailRuler.WithSameLeft(ResetButton),
                EmailRuler.WithSameRight(ResetButton),
                EmailRuler.Height().EqualTo(0),

                EmailInput.Above(EmailRuler, 15),
                EmailInput.AtRightOf(ContainerView, 15),
                EmailInput.Height().EqualTo(40),
                EmailInput.ToRightOf(EmailImage, 0),

                EmailImage.WithSameCenterY(EmailInput),
                EmailImage.WithSameLeft(EmailRuler),
                EmailImage.Height().EqualTo(0),
                EmailImage.Width().EqualTo(0),

                ResetButton.WithSameCenterX(ContainerView),
                ResetButton.AtBottomOf(ContainerView, 80),
                ResetButton.AtLeftOf(ContainerView, 15),
                ResetButton.AtRightOf(ContainerView, 15),
                ResetButton.Height().EqualTo(40)
                );
        }
コード例 #2
0
ファイル: LoginView.cs プロジェクト: divine514/BisnerXamarin
        private void SetupConstraints()
        {
            ScrollView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
            _containerView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            View.AddConstraints(
                _containerView.WithSameWidth(View),

                _background.AtTopOf(View),
                _background.AtLeftOf(View),
                _background.AtRightOf(View),
                _background.AtBottomOf(View)
                );

            ScrollView.AddConstraints(
                _containerView.AtTopOf(ScrollView),
                _containerView.AtLeftOf(ScrollView),
                _containerView.AtRightOf(ScrollView),
                _containerView.AtBottomOf(ScrollView),
                _containerView.Height().EqualTo(UIScreen.MainScreen.Bounds.Height)
                );

            _containerView.AddConstraints(
                _logo.AtTopOf(_containerView, 40),
                _logo.WithSameCenterX(_containerView),

                _indicator.Below(_logo, 30),
                _indicator.WithSameCenterX(_logo),

                _registerButton.AtBottomOf(_containerView, 40),
                _registerButton.AtLeftOf(_containerView, 35),

                _forgotPasswordButton.AtBottomOf(_containerView, 40),
                _forgotPasswordButton.AtRightOf(_containerView, 35),

                _signinButton.Above(_registerButton, 40),
                _signinButton.Height().EqualTo(40),
                _signinButton.WithSameLeft(_registerButton),
                _signinButton.WithSameRight(_forgotPasswordButton),

                _passwordRuler.Above(_signinButton, 30),
                _passwordRuler.WithSameLeft(_registerButton),
                _passwordRuler.WithSameRight(_forgotPasswordButton),
                _passwordRuler.Height().EqualTo(1),

                _password.Above(_passwordRuler, 15),
                _password.WithSameRight(_forgotPasswordButton),
                _password.Height().EqualTo(20),
                _password.ToRightOf(_passwordImage, 15),

                _passwordImage.WithSameCenterY(_password),
                _passwordImage.WithSameLeft(_passwordRuler),
                _passwordImage.Height().EqualTo(20),
                _passwordImage.Width().EqualTo(20),

                _emailRuler.Above(_password, 15),
                _emailRuler.WithSameLeft(_registerButton),
                _emailRuler.WithSameRight(_forgotPasswordButton),
                _emailRuler.Height().EqualTo(1),

                _email.Above(_emailRuler, 15),
                _email.WithSameRight(_forgotPasswordButton),
                _email.Height().EqualTo(20),
                _email.ToRightOf(_emailImage, 15),

                _emailImage.WithSameCenterY(_email),
                _emailImage.WithSameLeft(_emailRuler),
                _emailImage.Height().EqualTo(20),
                _emailImage.Width().EqualTo(20)
                );
        }