protected override void CreateConstraints()
        {
            base.CreateConstraints();

            ContentView.AddConstraints(

                _stackView.AtLeftOf(ContentView, PADDING),
                _stackView.AtTopOf(ContentView, PADDING),
                _stackView.AtRightOf(ContentView, PADDING),
                _stackView.AtBottomOf(ContentView, PADDING)
                );
        }
Esempio n. 2
0
        protected override void InitializeObjects()
        {
            base.InitializeObjects();

            var topView    = new UIView();
            var stackView  = new UIStackView();
            var scrollView = new UIScrollView();

            topTextRowView    = new UIView();
            centerTextRowView = new UIView();
            var bottomTextRowView = new UIView();
            var bottomView        = new UIView();
            var profileNavigationBarBackground = new UIImageView(UIImage.FromBundle(@"Images/navigation_bar_background.png"));

            backHomeView = UIButton.FromType(UIButtonType.Custom);
            backHomeView.SetImage(UIImage.FromFile(@"Images/ic_back.png"), UIControlState.Normal);
            nameOfPageLabel           = LabelInformationAboutPage(UIColor.White, "Registration", UIFont.BoldSystemFontOfSize(16f));
            informationAboutPageLabel = LabelInformationAboutPage(UIColor.FromRGB(29, 157, 189), "", UIFont.FromName("Helvetica", 14f));

            // Hide navigation bar
            NavigationController.SetNavigationBarHidden(true, false);
            View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile(@"Images/tab_background.png").Scale(View.Frame.Size));
            profileNavigationBarBackground.Frame = new CGRect(10, 10, profileNavigationBarBackground.Image.CGImage.Width, profileNavigationBarBackground.Image.CGImage.Height);
            var s = UIScreen.MainScreen.Bounds.Width;

            var labelView = new UIView();

            labelView.AddIfNotNull(nameOfPageLabel, informationAboutPageLabel);
            labelView.AddConstraints(
                nameOfPageLabel.AtTopOf(labelView, 20),
                nameOfPageLabel.WithSameCenterX(labelView),
                nameOfPageLabel.WithSameCenterY(labelView),
                nameOfPageLabel.WithSameWidth(labelView),
                nameOfPageLabel.WithRelativeHeight(labelView, 0.3f),

                informationAboutPageLabel.Below(nameOfPageLabel, 5),
                informationAboutPageLabel.WithSameWidth(labelView),
                informationAboutPageLabel.WithSameCenterX(labelView),
                informationAboutPageLabel.WithRelativeHeight(labelView, 0.3f)
                );

            topView.AddIfNotNull(profileNavigationBarBackground, backHomeView, labelView);
            topView.AddConstraints(
                profileNavigationBarBackground.WithSameWidth(topView),
                profileNavigationBarBackground.WithSameHeight(topView),
                profileNavigationBarBackground.AtTopOf(topView),

                backHomeView.WithSameCenterY(topView),
                backHomeView.AtLeftOf(topView, 20),
                backHomeView.WithRelativeWidth(topView, 0.1f),
                backHomeView.WithRelativeHeight(topView, 0.2f),

                labelView.WithSameCenterX(topView),
                labelView.WithSameCenterY(topView),
                labelView.WithRelativeWidth(topView, 0.8f),
                labelView.WithRelativeHeight(topView, 0.6f)
                );

            firstNameTextField       = TextFieldInitializer("First Name");
            lastNameTextField        = TextFieldInitializer("Last Name");
            emailTextField           = TextFieldInitializer("Email");
            passwordTextField        = TextFieldInitializer("Password *");
            confirmPasswordTextField = TextFieldInitializer("Confirm Password *");
            phoneNumberTextField     = TextFieldInitializer("(000) 000-0000 *");

            registrationButton = ButtonInitializer("Registration", UIControlState.Normal, Theme.BlueDark.ToUIColor(),
                                                   UIColor.White, UIControlState.Normal, null, UIControlState.Disabled);

            topTextRowView.AddIfNotNull(firstNameTextField, lastNameTextField);
            topTextRowView.AddConstraints(
                firstNameTextField.AtTopOf(topTextRowView),
                firstNameTextField.AtLeftOf(topTextRowView),
                firstNameTextField.WithRelativeWidth(topTextRowView, 0.475f),
                firstNameTextField.WithSameHeight(topTextRowView),

                lastNameTextField.AtTopOf(topTextRowView),
                lastNameTextField.AtRightOf(topTextRowView),
                lastNameTextField.WithRelativeWidth(topTextRowView, 0.475f),
                lastNameTextField.WithSameHeight(topTextRowView)
                );

            centerTextRowView.AddIfNotNull(emailTextField, passwordTextField, confirmPasswordTextField);
            centerTextRowView.AddConstraints(
                emailTextField.AtTopOf(centerTextRowView),
                emailTextField.WithSameCenterX(centerTextRowView),
                emailTextField.WithSameWidth(centerTextRowView),
                emailTextField.WithRelativeHeight(centerTextRowView, 0.3f),

                passwordTextField.Below(emailTextField, 10),
                passwordTextField.WithSameCenterX(centerTextRowView),
                passwordTextField.WithSameWidth(centerTextRowView),
                passwordTextField.WithRelativeHeight(centerTextRowView, 0.3f),

                confirmPasswordTextField.Below(passwordTextField, 10),
                confirmPasswordTextField.WithSameCenterX(centerTextRowView),
                confirmPasswordTextField.WithSameWidth(centerTextRowView),
                confirmPasswordTextField.WithRelativeHeight(centerTextRowView, 0.3f)
                );

            bottomView.AddIfNotNull(registrationButton, phoneNumberTextField);
            bottomView.AddConstraints(
                phoneNumberTextField.AtTopOf(bottomView),
                phoneNumberTextField.WithSameCenterX(bottomView),
                phoneNumberTextField.WithSameWidth(bottomView),
                phoneNumberTextField.WithRelativeHeight(bottomView, 0.4f),

                registrationButton.Below(phoneNumberTextField, 10),
                registrationButton.WithSameCenterX(bottomView),
                registrationButton.WithSameWidth(bottomView),
                registrationButton.WithRelativeHeight(bottomView, 0.4f)
                );

            stackView.AddIfNotNull(topTextRowView, centerTextRowView, bottomView);
            stackView.AddConstraints(
                topTextRowView.AtTopOf(stackView, 30),
                topTextRowView.WithSameWidth(stackView),
                topTextRowView.WithSameCenterX(stackView),
                topTextRowView.WithRelativeHeight(stackView, 0.10f),

                centerTextRowView.Below(topTextRowView, 10),
                centerTextRowView.WithSameWidth(stackView),
                centerTextRowView.AtLeftOf(stackView),
                centerTextRowView.AtRightOf(stackView),
                centerTextRowView.WithRelativeHeight(stackView, 0.35f),

                bottomView.Below(centerTextRowView, 10),
                bottomView.WithSameWidth(stackView),
                bottomView.AtLeftOf(stackView),
                bottomView.AtRightOf(stackView),
                bottomView.WithRelativeHeight(stackView, 0.25f)
                );

            View.AddIfNotNull(topView, stackView);
            View.AddConstraints(
                topView.AtTopOf(View),
                topView.WithSameWidth(View),
                topView.WithRelativeHeight(View, 0.2f),

                stackView.Below(topView, 30),
                stackView.AtLeftOf(View, 30),
                stackView.AtRightOf(View, 30),
                stackView.WithRelativeHeight(View, 0.8f)
                );

            EnableNextKeyForTextFields(firstNameTextField.TextFieldWithValidator.TextField, lastNameTextField.TextFieldWithValidator.TextField, emailTextField.TextFieldWithValidator.TextField,
                                       passwordTextField.TextFieldWithValidator.TextField, confirmPasswordTextField.TextFieldWithValidator.TextField, phoneNumberTextField.TextFieldWithValidator.TextField);
        }