コード例 #1
0
        public override void ViewDidLoad()
        {
            View.BackgroundColor = UIColor.White;
            base.ViewDidLoad();

            var subTotal = new UITextField() { BorderStyle = UITextBorderStyle.RoundedRect };
            subTotal.KeyboardType = UIKeyboardType.DecimalPad;
            Add(subTotal);

            var seek = new UISlider()
                {
                    MinValue = 0,
                    MaxValue = 100,
                };
            Add(seek);

            var seekLabel = new UILabel();
            Add(seekLabel);

            var tipLabel = new UILabel();
            Add(tipLabel);

            var totalLabel = new UILabel();
            Add(totalLabel);

            var set = this.CreateBindingSet<TipView, TipViewModel>();
            set.Bind(subTotal).To(vm => vm.SubTotal);
            set.Bind(seek).To(vm => vm.Generosity);
            set.Bind(seekLabel).To(vm => vm.Generosity);
            set.Bind(tipLabel).To(vm => vm.Tip);
            set.Bind(totalLabel).To("SubTotal + Tip");
            set.Apply();

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            var margin = 10;
            View.AddConstraints(
                    subTotal.AtLeftOf(View, margin),
                    subTotal.AtTopOf(View, margin),
                    subTotal.AtRightOf(View, margin),

                    seek.WithSameLeft(subTotal),
                    seek.Below(subTotal, margin),
                    seek.ToLeftOf(seekLabel, margin),
                    seek.WithRelativeWidth(seekLabel, 3),

                    seekLabel.WithSameRight(subTotal),
                    seekLabel.WithSameTop(seek),

                    tipLabel.Below(seek, margin),
                    tipLabel.WithSameLeft(seek),
                    tipLabel.WithSameWidth(totalLabel),

                    totalLabel.WithSameTop(tipLabel),
                    totalLabel.ToRightOf(tipLabel, margin),
                    totalLabel.WithSameRight(subTotal)
                );
        }
コード例 #2
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)
                );
        }
コード例 #3
0
        protected override void SetupConstraints()
        {
            base.SetupConstraints();

            View.AddConstraints(new[]
            {
                _searchTextField.AtTopOf(View, 15),
                _searchTextField.AtLeftOf(View, 20),
                _searchTextField.AtRightOf(View, 20),

                _separatorView.Below(_searchTextField, 15),
                _separatorView.AtLeftOf(View),
                _separatorView.AtRightOf(View),
                _separatorView.Height().EqualTo(1),

                _tableView.Below(_separatorView),
                _tableView.AtLeftOf(View),
                _tableView.AtRightOf(View),
                _tableView.AtBottomOf(View)
            });
        }
コード例 #4
0
ファイル: SignupViewController.cs プロジェクト: jblj/mobile
        public override void LoadView ()
        {
            View = new UIView ()
                .Apply (Style.Screen);

            View.Add (inputsContainer = new UIView ().Apply (Style.Signup.InputsContainer));

            inputsContainer.Add (topBorder = new UIView ().Apply (Style.Signup.InputsBorder));

            inputsContainer.Add (emailTextField = new UITextField () {
                Placeholder = "SignupEmailHint".Tr (),
                AutocapitalizationType = UITextAutocapitalizationType.None,
                KeyboardType = UIKeyboardType.EmailAddress,
                ReturnKeyType = UIReturnKeyType.Next,
                ClearButtonMode = UITextFieldViewMode.Always,
                ShouldReturn = HandleShouldReturn,
            }.Apply (Style.Signup.EmailField));
            emailTextField.EditingChanged += OnTextFieldEditingChanged;

            inputsContainer.Add (middleBorder = new UIView ().Apply (Style.Signup.InputsBorder));

            inputsContainer.Add(passwordTextField = new PasswordTextField () {
                Placeholder = "SignupPasswordHint".Tr (),
                AutocapitalizationType = UITextAutocapitalizationType.None,
                AutocorrectionType = UITextAutocorrectionType.No,
                SecureTextEntry = true,
                ReturnKeyType = UIReturnKeyType.Go,
                ShouldReturn = HandleShouldReturn,
            }.Apply (Style.Signup.PasswordField));
            passwordTextField.EditingChanged += OnTextFieldEditingChanged;

            inputsContainer.Add (bottomBorder = new UIView ().Apply (Style.Signup.InputsBorder));

            View.Add (passwordActionButton = new UIButton ()
                .Apply (Style.Signup.SignupButton));
            passwordActionButton.SetTitle ("SignupSignupButtonText".Tr (), UIControlState.Normal);
            passwordActionButton.TouchUpInside += OnPasswordActionButtonTouchUpInside;

            View.Add (googleActionButton = new UIButton ()
                .Apply (Style.Signup.GoogleButton));
            googleActionButton.SetTitle ("SignupGoogleButtonText".Tr (), UIControlState.Normal);
            googleActionButton.TouchUpInside += OnGoogleActionButtonTouchUpInside;

            View.Add (legalLabel = new TTTAttributedLabel () {
                Delegate = new LegalLabelDelegate (),
            }.Apply (Style.Signup.LegalLabel));
            SetLegalText (legalLabel);

            inputsContainer.AddConstraints (
                topBorder.AtTopOf (inputsContainer),
                topBorder.AtLeftOf (inputsContainer),
                topBorder.AtRightOf (inputsContainer),
                topBorder.Height ().EqualTo (1f),

                emailTextField.Below (topBorder),
                emailTextField.AtLeftOf (inputsContainer, 20f),
                emailTextField.AtRightOf (inputsContainer, 10f),
                emailTextField.Height ().EqualTo (42f),

                middleBorder.Below (emailTextField),
                middleBorder.AtLeftOf (inputsContainer, 20f),
                middleBorder.AtRightOf (inputsContainer),
                middleBorder.Height ().EqualTo (1f),

                passwordTextField.Below (middleBorder),
                passwordTextField.AtLeftOf (inputsContainer, 20f),
                passwordTextField.AtRightOf (inputsContainer),
                passwordTextField.Height ().EqualTo (42f),

                bottomBorder.Below (passwordTextField),
                bottomBorder.AtLeftOf (inputsContainer),
                bottomBorder.AtRightOf (inputsContainer),
                bottomBorder.AtBottomOf (inputsContainer),
                bottomBorder.Height ().EqualTo (1f)
            );

            inputsContainer.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints ();

            View.AddConstraints (
                inputsContainer.AtTopOf (View, 80f),
                inputsContainer.AtLeftOf (View),
                inputsContainer.AtRightOf (View),

                passwordActionButton.Below (inputsContainer, 20f),
                passwordActionButton.AtLeftOf (View),
                passwordActionButton.AtRightOf (View),
                passwordActionButton.Height ().EqualTo (60f),

                googleActionButton.Below (passwordActionButton, 5f),
                googleActionButton.AtLeftOf (View),
                googleActionButton.AtRightOf (View),
                googleActionButton.Height ().EqualTo (60f),

                legalLabel.AtBottomOf (View, 30f),
                legalLabel.AtLeftOf (View, 40f),
                legalLabel.AtRightOf (View, 40f)
            );

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints ();

            ResetSignupButtonState ();
        }
コード例 #5
0
        private void SetupView()
        {
            NavigationController.SetNavigationBarHidden(true, true);

            View.BackgroundColor = UIColor.White;

            _logoImage             = new UIImageView();
            _logoImage.Image       = UIImage.FromBundle("login_logo");
            _logoImage.Frame       = new CGRect(0, 0, _logoImage.Image.CGImage.Width, _logoImage.Image.CGImage.Height);
            _logoImage.ContentMode = UIViewContentMode.ScaleAspectFit;

            var firstAttributes = new UIStringAttributes
            {
                ForegroundColor = UIColor.FromRGB(36, 183, 128),
                Font            = UIFont.FromName("ArialMT", 15f)
            };

            _loginTextField = new UITextField(new CGRect())
            {
                AttributedPlaceholder = new NSAttributedString("Username...", firstAttributes),
            };
            _loginTextField.TextColor = UIColor.FromRGB(36, 183, 128);
            _loginTextField.Font      = UIFont.FromName("ArialMT", 15f);


            _passwordTextField = new UITextField(new CGRect())
            {
                AttributedPlaceholder = new NSAttributedString("Password...", firstAttributes),
                SecureTextEntry       = true
            };
            _passwordTextField.TextColor = UIColor.FromRGB(36, 183, 128);
            _passwordTextField.Font      = UIFont.FromName("ArialMT", 15f);


            _loginButton = new UIButton(UIButtonType.System);
            _loginButton.SetTitle("Login", UIControlState.Normal);
            _loginButton.Font = UIFont.FromName("ArialMT", 15f);
            _loginButton.SetTitleColor(UIColor.White, UIControlState.Normal);
            _loginButton.Layer.BorderWidth  = 1;
            _loginButton.BackgroundColor    = UIColor.FromRGB(36, 183, 128);
            _loginButton.Layer.CornerRadius = 10;
            _loginButton.Layer.BorderColor  = UIColor.Black.CGColor;


            Add(_logoImage);
            Add(_loginTextField);
            Add(_passwordTextField);
            Add(_loginButton);

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            View.AddConstraints(_logoImage.AtTopOf(View, 80),
                                _logoImage.Height().EqualTo(90),
                                _logoImage.Width().EqualTo(90),
                                _logoImage.WithSameCenterX(View),
                                _loginTextField.WithSameCenterX(View),
                                _loginTextField.Below(_logoImage, 40),
                                _loginTextField.AtLeftOf(View, 40),
                                _loginTextField.AtRightOf(View, 40),
                                _passwordTextField.WithSameCenterX(_loginTextField),
                                _passwordTextField.Below(_loginTextField, 20),
                                _passwordTextField.AtLeftOf(View, 40),
                                _passwordTextField.AtRightOf(View, 40),
                                _loginButton.WithSameCenterX(_passwordTextField),
                                _loginButton.Below(_passwordTextField, 40),
                                _loginButton.AtLeftOf(View, 40),
                                _loginButton.AtRightOf(View, 40)
                                );
        }
コード例 #6
0
        public override void ViewDidLoad()
        {
            View.BackgroundColor = UIColor.White;
            base.ViewDidLoad();

            // ios7 layout
            if (RespondsToSelector(new Selector("edgesForExtendedLayout")))
            {
                EdgesForExtendedLayout = UIRectEdge.None;
            }

            var subTotal = new UITextField()
            {
                BorderStyle = UITextBorderStyle.RoundedRect
            };

            subTotal.KeyboardType = UIKeyboardType.DecimalPad;
            Add(subTotal);

            var seek = new UISlider()
            {
                MinValue = 0,
                MaxValue = 100,
            };

            Add(seek);

            var seekLabel = new UILabel();

            Add(seekLabel);

            var tipLabel = new UILabel();

            Add(tipLabel);

            var totalLabel = new UILabel();

            Add(totalLabel);

            var set = this.CreateBindingSet <TipView, TipViewModel>();

            set.Bind(subTotal).To(vm => vm.SubTotal);
            set.Bind(seek).To(vm => vm.Generosity);
            set.Bind(seekLabel).To(vm => vm.Generosity);
            set.Bind(tipLabel).To(vm => vm.Tip);
            set.Bind(totalLabel).To("SubTotal + Tip");
            set.Apply();

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            var margin = 10;

            View.AddConstraints(
                subTotal.AtLeftOf(View, margin),
                subTotal.AtTopOf(View, margin),
                subTotal.AtRightOf(View, margin),

                seek.WithSameLeft(subTotal),
                seek.Below(subTotal, margin),
                seek.ToLeftOf(seekLabel, margin),
                seek.WithRelativeWidth(seekLabel, 3),

                seekLabel.WithSameRight(subTotal),
                seekLabel.WithSameTop(seek),

                tipLabel.Below(seek, margin),
                tipLabel.WithSameLeft(seek),
                tipLabel.WithSameWidth(totalLabel),

                totalLabel.WithSameTop(tipLabel),
                totalLabel.ToRightOf(tipLabel, margin),
                totalLabel.WithSameRight(subTotal)
                );
        }
コード例 #7
0
        public override void LoadView ()
        {
            View = new UIView ()
                .Apply (Style.Screen);

            View.Add (inputsContainer = new UIView ().Apply (Style.Login.InputsContainer));

            inputsContainer.Add (topBorder = new UIView ().Apply (Style.Login.InputsBorder));

            inputsContainer.Add (emailTextField = new UITextField () {
                Placeholder = "LoginEmailHint".Tr (),
                AutocapitalizationType = UITextAutocapitalizationType.None,
                KeyboardType = UIKeyboardType.EmailAddress,
                ReturnKeyType = UIReturnKeyType.Next,
                ClearButtonMode = UITextFieldViewMode.Always,
                ShouldReturn = HandleShouldReturn,
            }.Apply (Style.Login.EmailField));

            inputsContainer.Add (middleBorder = new UIView ().Apply (Style.Login.InputsBorder));

            inputsContainer.Add (passwordTextField = new UITextField () {
                Placeholder = "LoginPasswordHint".Tr (),
                AutocapitalizationType = UITextAutocapitalizationType.None,
                AutocorrectionType = UITextAutocorrectionType.No,
                SecureTextEntry = true,
                ReturnKeyType = UIReturnKeyType.Go,
                ShouldReturn = HandleShouldReturn,
            }.Apply (Style.Login.PasswordField));

            inputsContainer.Add (bottomBorder = new UIView ().Apply (Style.Login.InputsBorder));

            View.Add (passwordActionButton = new UIButton ()
                .Apply (Style.Login.LoginButton));
            passwordActionButton.SetTitle ("LoginLoginButtonText".Tr (), UIControlState.Normal);
            passwordActionButton.TouchUpInside += OnPasswordActionButtonTouchUpInside;

            inputsContainer.AddConstraints (
                topBorder.AtTopOf (inputsContainer),
                topBorder.AtLeftOf (inputsContainer),
                topBorder.AtRightOf (inputsContainer),
                topBorder.Height ().EqualTo (1f),

                emailTextField.Below (topBorder),
                emailTextField.AtLeftOf (inputsContainer, 20f),
                emailTextField.AtRightOf (inputsContainer, 10f),
                emailTextField.Height ().EqualTo (42f),

                middleBorder.Below (emailTextField),
                middleBorder.AtLeftOf (inputsContainer, 20f),
                middleBorder.AtRightOf (inputsContainer),
                middleBorder.Height ().EqualTo (1f),

                passwordTextField.Below (middleBorder),
                passwordTextField.AtLeftOf (inputsContainer, 20f),
                passwordTextField.AtRightOf (inputsContainer),
                passwordTextField.Height ().EqualTo (42f),

                bottomBorder.Below (passwordTextField),
                bottomBorder.AtLeftOf (inputsContainer),
                bottomBorder.AtRightOf (inputsContainer),
                bottomBorder.AtBottomOf (inputsContainer),
                bottomBorder.Height ().EqualTo (1f)
            );

            inputsContainer.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints ();

            View.AddConstraints (
                inputsContainer.AtTopOf (View, 80f),
                inputsContainer.AtLeftOf (View),
                inputsContainer.AtRightOf (View),

                passwordActionButton.Below (inputsContainer, 20f),
                passwordActionButton.AtLeftOf (View),
                passwordActionButton.AtRightOf (View),
                passwordActionButton.Height ().EqualTo (60f)
            );

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints ();
        }
コード例 #8
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            if (RespondsToSelector(new Selector("setEdgesForExtendedLayout:")))
            {
                EdgesForExtendedLayout = UIRectEdge.None;
            }

            View.BackgroundColor = UIColor.White;

            var isConnectedLabel = new UILabel {
                Text = "Is Connected?"
            };

            var isWifiLabel = new UILabel {
                Text = "Is Wifi?"
            };

            var isCellularLabel = new UILabel {
                Text = "Is Cellular?"
            };

            var isConnected = new UILabel();
            var isWifi      = new UILabel();
            var isCellular  = new UILabel();

            var hostNameEntry = new UITextField {
                Placeholder = "Enter host name (ostebaronen.dk)"
            };
            var checkHostNameButton = new UIButton(UIButtonType.System);

            checkHostNameButton.SetTitle("Resolve host name", UIControlState.Normal);
            var hostNameResolvedLabel = new UILabel();

            var bset = this.CreateBindingSet <TestViewController, TestViewModel>();

            bset.Bind(isConnected).To(vm => vm.Connectivity.IsConnected);
            bset.Bind(isWifi).To(vm => vm.Connectivity.IsWifi);
            bset.Bind(isCellular).To(vm => vm.Connectivity.IsCellular);

            bset.Bind(hostNameEntry).To(vm => vm.HostName);
            bset.Bind(hostNameResolvedLabel).To(vm => vm.HostResolved);
            bset.Apply();

            checkHostNameButton.TouchUpInside += (sender, args) => {
                ViewModel.ResolveHostCommand.Execute(null);
            };

            View.Add(isConnectedLabel);
            View.Add(isWifiLabel);
            View.Add(isCellularLabel);
            View.Add(isConnected);
            View.Add(isWifi);
            View.Add(isCellular);
            View.Add(hostNameEntry);
            View.Add(checkHostNameButton);
            View.Add(hostNameResolvedLabel);
            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            nfloat padding = 10f;

            View.AddConstraints(
                isConnectedLabel.AtTopOf(View, padding),
                isConnectedLabel.AtLeftOf(View, padding),
                isConnectedLabel.AtRightOf(View, padding),

                isConnected.Below(isConnectedLabel, padding),
                isConnected.AtLeftOf(View, padding),
                isConnected.AtRightOf(View, padding),

                isWifiLabel.Below(isConnected, padding),
                isWifiLabel.AtLeftOf(View, padding),
                isWifiLabel.AtRightOf(View, padding),

                isWifi.Below(isWifiLabel, padding),
                isWifi.AtLeftOf(View, padding),
                isWifi.AtRightOf(View, padding),

                isCellularLabel.Below(isWifi, padding),
                isCellularLabel.AtLeftOf(View, padding),
                isCellularLabel.AtRightOf(View, padding),

                isCellular.Below(isCellularLabel, padding),
                isCellular.AtLeftOf(View, padding),
                isCellular.AtRightOf(View, padding),

                hostNameEntry.Below(isCellular, padding),
                hostNameEntry.AtLeftOf(View, padding),
                hostNameEntry.AtRightOf(View, padding),

                checkHostNameButton.Below(hostNameEntry, padding),
                checkHostNameButton.AtLeftOf(View, padding),
                checkHostNameButton.AtRightOf(View, padding),

                hostNameResolvedLabel.Below(checkHostNameButton, padding),
                hostNameResolvedLabel.AtLeftOf(View, padding),
                hostNameResolvedLabel.AtRightOf(View, padding)
                );
        }
コード例 #9
0
ファイル: LoginViewController.cs プロジェクト: uthens/mobile
        public override void LoadView()
        {
            View = new UIView()
                   .Apply(Style.Screen);

            View.Add(inputsContainer = new UIView().Apply(Style.Login.InputsContainer));

            inputsContainer.Add(topBorder = new UIView().Apply(Style.Login.InputsBorder));

            inputsContainer.Add(emailTextField = new UITextField()
            {
                Placeholder            = "LoginEmailHint".Tr(),
                AutocapitalizationType = UITextAutocapitalizationType.None,
                KeyboardType           = UIKeyboardType.EmailAddress,
                ReturnKeyType          = UIReturnKeyType.Next,
                ClearButtonMode        = UITextFieldViewMode.Always,
                ShouldReturn           = HandleShouldReturn,
                AutocorrectionType     = UITextAutocorrectionType.No
            }.Apply(Style.Login.EmailField));

            inputsContainer.Add(middleBorder = new UIView().Apply(Style.Login.InputsBorder));

            inputsContainer.Add(passwordTextField = new PasswordTextField()
            {
                Placeholder            = "LoginPasswordHint".Tr(),
                AutocapitalizationType = UITextAutocapitalizationType.None,
                AutocorrectionType     = UITextAutocorrectionType.No,
                SecureTextEntry        = true,
                ReturnKeyType          = UIReturnKeyType.Go,
                ShouldReturn           = HandleShouldReturn,
            }.Apply(Style.Login.PasswordField));

            inputsContainer.Add(bottomBorder = new UIView().Apply(Style.Login.InputsBorder));

            View.Add(passwordActionButton = new UIButton()
                                            .Apply(Style.Login.LoginButton));
            passwordActionButton.SetTitle("LoginLoginButtonText".Tr(), UIControlState.Normal);
            passwordActionButton.TouchUpInside += OnPasswordActionButtonTouchUpInside;

            inputsContainer.AddConstraints(
                topBorder.AtTopOf(inputsContainer),
                topBorder.AtLeftOf(inputsContainer),
                topBorder.AtRightOf(inputsContainer),
                topBorder.Height().EqualTo(1f),

                emailTextField.Below(topBorder),
                emailTextField.AtLeftOf(inputsContainer, 20f),
                emailTextField.AtRightOf(inputsContainer, 10f),
                emailTextField.Height().EqualTo(42f),

                middleBorder.Below(emailTextField),
                middleBorder.AtLeftOf(inputsContainer, 20f),
                middleBorder.AtRightOf(inputsContainer),
                middleBorder.Height().EqualTo(1f),

                passwordTextField.Below(middleBorder),
                passwordTextField.AtLeftOf(inputsContainer, 20f),
                passwordTextField.AtRightOf(inputsContainer),
                passwordTextField.Height().EqualTo(42f),

                bottomBorder.Below(passwordTextField),
                bottomBorder.AtLeftOf(inputsContainer),
                bottomBorder.AtRightOf(inputsContainer),
                bottomBorder.AtBottomOf(inputsContainer),
                bottomBorder.Height().EqualTo(1f)
                );

            inputsContainer.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            View.AddConstraints(
                inputsContainer.AtTopOf(View, 80f),
                inputsContainer.AtLeftOf(View),
                inputsContainer.AtRightOf(View),

                passwordActionButton.Below(inputsContainer, 20f),
                passwordActionButton.AtLeftOf(View),
                passwordActionButton.AtRightOf(View),
                passwordActionButton.Height().EqualTo(60f)
                );

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
        }
コード例 #10
0
        public override void LoadView()
        {
            View = new UIView()
                   .Apply(Style.Screen);

            View.Add(inputsContainer = new UIView().Apply(Style.Signup.InputsContainer));

            inputsContainer.Add(topBorder = new UIView().Apply(Style.Signup.InputsBorder));

            inputsContainer.Add(emailTextField = new UITextField()
            {
                Placeholder            = "SignupEmailHint".Tr(),
                AutocapitalizationType = UITextAutocapitalizationType.None,
                KeyboardType           = UIKeyboardType.EmailAddress,
                ReturnKeyType          = UIReturnKeyType.Next,
                ClearButtonMode        = UITextFieldViewMode.Always,
                ShouldReturn           = HandleShouldReturn,
            }.Apply(Style.Signup.EmailField));
            emailTextField.EditingChanged += OnTextFieldEditingChanged;

            inputsContainer.Add(middleBorder = new UIView().Apply(Style.Signup.InputsBorder));

            inputsContainer.Add(passwordTextField = new PasswordTextField()
            {
                Placeholder            = "SignupPasswordHint".Tr(),
                AutocapitalizationType = UITextAutocapitalizationType.None,
                AutocorrectionType     = UITextAutocorrectionType.No,
                SecureTextEntry        = true,
                ReturnKeyType          = UIReturnKeyType.Go,
                ShouldReturn           = HandleShouldReturn,
            }.Apply(Style.Signup.PasswordField));
            passwordTextField.EditingChanged += OnTextFieldEditingChanged;

            inputsContainer.Add(bottomBorder = new UIView().Apply(Style.Signup.InputsBorder));

            View.Add(passwordActionButton = new UIButton()
                                            .Apply(Style.Signup.SignupButton));
            passwordActionButton.SetTitle("SignupSignupButtonText".Tr(), UIControlState.Normal);
            passwordActionButton.TouchUpInside += OnPasswordActionButtonTouchUpInside;

            View.Add(googleActionButton = new UIButton()
                                          .Apply(Style.Signup.GoogleButton));
            googleActionButton.SetTitle("SignupGoogleButtonText".Tr(), UIControlState.Normal);
            googleActionButton.TouchUpInside += OnGoogleActionButtonTouchUpInside;

            View.Add(legalLabel = new TTTAttributedLabel()
            {
                Delegate = new LegalLabelDelegate(),
            }.Apply(Style.Signup.LegalLabel));
            SetLegalText(legalLabel);

            inputsContainer.AddConstraints(
                topBorder.AtTopOf(inputsContainer),
                topBorder.AtLeftOf(inputsContainer),
                topBorder.AtRightOf(inputsContainer),
                topBorder.Height().EqualTo(1f),

                emailTextField.Below(topBorder),
                emailTextField.AtLeftOf(inputsContainer, 20f),
                emailTextField.AtRightOf(inputsContainer, 10f),
                emailTextField.Height().EqualTo(42f),

                middleBorder.Below(emailTextField),
                middleBorder.AtLeftOf(inputsContainer, 20f),
                middleBorder.AtRightOf(inputsContainer),
                middleBorder.Height().EqualTo(1f),

                passwordTextField.Below(middleBorder),
                passwordTextField.AtLeftOf(inputsContainer, 20f),
                passwordTextField.AtRightOf(inputsContainer),
                passwordTextField.Height().EqualTo(42f),

                bottomBorder.Below(passwordTextField),
                bottomBorder.AtLeftOf(inputsContainer),
                bottomBorder.AtRightOf(inputsContainer),
                bottomBorder.AtBottomOf(inputsContainer),
                bottomBorder.Height().EqualTo(1f)
                );

            inputsContainer.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            View.AddConstraints(
                inputsContainer.AtTopOf(View, 80f),
                inputsContainer.AtLeftOf(View),
                inputsContainer.AtRightOf(View),

                passwordActionButton.Below(inputsContainer, 20f),
                passwordActionButton.AtLeftOf(View),
                passwordActionButton.AtRightOf(View),
                passwordActionButton.Height().EqualTo(60f),

                googleActionButton.Below(passwordActionButton, 5f),
                googleActionButton.AtLeftOf(View),
                googleActionButton.AtRightOf(View),
                googleActionButton.Height().EqualTo(60f),

                legalLabel.AtBottomOf(View, 30f),
                legalLabel.AtLeftOf(View, 40f),
                legalLabel.AtRightOf(View, 40f)
                );

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            ResetSignupButtonState();
        }
コード例 #11
0
ファイル: LoginView.cs プロジェクト: divine514/BisnerXamarin
        private void SetupConstraints2()
        {
            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, 60),
                _registerButton.WithSameCenterX(_containerView),

                _forgotPasswordButton.AtRightOf(_password, 15),
                _forgotPasswordButton.Height().EqualTo(15),
                _forgotPasswordButton.Width().EqualTo(15),
                _forgotPasswordButton.WithSameCenterY(_password),

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

                _passwordRuler.Above(_signinButton, 15),
                _passwordRuler.WithSameLeft(_registerButton),
                _passwordRuler.WithSameRight(_forgotPasswordButton),
                _passwordRuler.Height().EqualTo(0),

                _password.Above(_passwordRuler, 0),
                _password.AtRightOf(_containerView, 15),
                _password.Height().EqualTo(40),
                _password.AtLeftOf(_containerView, 15),

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

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

                _email.Above(_emailRuler, 0),
                _email.AtRightOf(_containerView, 15),
                _email.Height().EqualTo(40),
                _email.AtLeftOf(_containerView, 15),

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