Beispiel #1
0
        void ConfigureViews()
        {
            View.BackgroundColor = UIColor.Clear;

            backgroundView.TranslatesAutoresizingMaskIntoConstraints = false;
            foregroundContentScrollView.TranslatesAutoresizingMaskIntoConstraints = false;
            foregroundContentView.TranslatesAutoresizingMaskIntoConstraints       = false;
            hueLabel           = new OverlayVibrantLabel();
            hueSlider          = ConfiguredOverlaySlider();
            hueSlider.MaxValue = 10;

            saturationLabel           = new OverlayVibrantLabel();
            saturationSlider          = ConfiguredOverlaySlider();
            saturationSlider.MaxValue = 2;

            brightnessLabel           = new OverlayVibrantLabel();
            brightnessSlider          = ConfiguredOverlaySlider();
            brightnessSlider.MinValue = -0.5f;
            brightnessSlider.MaxValue = 0.5f;

            saveButton = new UIButton(UIButtonType.System);
            saveButton.TranslatesAutoresizingMaskIntoConstraints = false;
            saveButton.SetTitle("Save", UIControlState.Normal);
            saveButton.TitleLabel.Font = UIFont.SystemFontOfSize(32);
            saveButton.TouchUpInside  += OnSaveClicked;

            View.AddSubview(backgroundView);
            View.AddSubview(foregroundContentScrollView);

            foregroundContentScrollView.AddSubview(foregroundContentView);

            foregroundContentView.ContentView.AddSubview(hueLabel);
            foregroundContentView.ContentView.AddSubview(hueSlider);

            foregroundContentView.ContentView.AddSubview(saturationLabel);
            foregroundContentView.ContentView.AddSubview(saturationSlider);

            foregroundContentView.ContentView.AddSubview(brightnessLabel);
            foregroundContentView.ContentView.AddSubview(brightnessSlider);

            foregroundContentView.ContentView.AddSubview(saveButton);

            foregroundContentScrollView.AddSubview(imageView);

            View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|[backgroundView]|",
                                                                    (NSLayoutFormatOptions)0,
                                                                    "backgroundView", backgroundView));
            View.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|[backgroundView]|",
                                                                    (NSLayoutFormatOptions)0,
                                                                    "backgroundView", backgroundView));

            View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|[foregroundContentScrollView]|",
                                                                    (NSLayoutFormatOptions)0,
                                                                    "foregroundContentScrollView", foregroundContentScrollView));
            View.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|[foregroundContentScrollView]|",
                                                                    (NSLayoutFormatOptions)0,
                                                                    "foregroundContentScrollView", foregroundContentScrollView));

            View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|[foregroundContentView]|",
                                                                    (NSLayoutFormatOptions)0,
                                                                    "foregroundContentView", foregroundContentView));
            View.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|[foregroundContentView]|",
                                                                    (NSLayoutFormatOptions)0,
                                                                    "foregroundContentView", foregroundContentView));

            View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-[hueLabel]-|",
                                                                    (NSLayoutFormatOptions)0,
                                                                    "hueLabel", hueLabel));
            View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-[hueSlider]-|",
                                                                    (NSLayoutFormatOptions)0,
                                                                    "hueSlider", hueSlider));
            View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-[saturationLabel]-|",
                                                                    (NSLayoutFormatOptions)0,
                                                                    "saturationLabel", saturationLabel));
            View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-[saturationSlider]-|",
                                                                    (NSLayoutFormatOptions)0,
                                                                    "saturationSlider", saturationSlider));
            View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-[brightnessLabel]-|",
                                                                    (NSLayoutFormatOptions)0,
                                                                    "brightnessLabel", brightnessLabel));
            View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-[brightnessSlider]-|",
                                                                    (NSLayoutFormatOptions)0,
                                                                    "brightnessSlider", brightnessSlider));
            View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-[saveButton]-|",
                                                                    (NSLayoutFormatOptions)0,
                                                                    "saveButton", saveButton));
            View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|[imageView(==foregroundContentScrollView)]|",
                                                                    (NSLayoutFormatOptions)0,
                                                                    "imageView", imageView,
                                                                    "foregroundContentScrollView", foregroundContentScrollView));
            View.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|-(>=30)-[hueLabel]-[hueSlider]-[saturationLabel]-[saturationSlider]-[brightnessLabel]-[brightnessSlider]-[saveButton]-(>=10)-[imageView(==200)]|",
                                                                    (NSLayoutFormatOptions)0,
                                                                    "hueLabel", hueLabel,
                                                                    "hueSlider", hueSlider,
                                                                    "saturationLabel", saturationLabel,
                                                                    "saturationSlider", saturationSlider,
                                                                    "brightnessLabel", brightnessLabel,
                                                                    "brightnessSlider", brightnessSlider,
                                                                    "saveButton", saveButton,
                                                                    "imageView", imageView));
        }
        void ConfigureViews()
        {
            View.BackgroundColor = UIColor.Clear;

            backgroundView.TranslatesAutoresizingMaskIntoConstraints = false;
            foregroundContentScrollView.TranslatesAutoresizingMaskIntoConstraints = false;
            foregroundContentView.TranslatesAutoresizingMaskIntoConstraints = false;
            hueLabel = new OverlayVibrantLabel ();
            hueSlider = ConfiguredOverlaySlider ();
            hueSlider.MaxValue = 10;

            saturationLabel = new OverlayVibrantLabel ();
            saturationSlider = ConfiguredOverlaySlider ();
            saturationSlider.MaxValue = 2;

            brightnessLabel = new OverlayVibrantLabel ();
            brightnessSlider = ConfiguredOverlaySlider ();
            brightnessSlider.MinValue = -0.5f;
            brightnessSlider.MaxValue = 0.5f;

            saveButton = new UIButton (UIButtonType.System);
            saveButton.TranslatesAutoresizingMaskIntoConstraints = false;
            saveButton.SetTitle ("Save", UIControlState.Normal);
            saveButton.TitleLabel.Font = UIFont.SystemFontOfSize (32);
            saveButton.TouchUpInside += OnSaveClicked;

            View.AddSubview (backgroundView);
            View.AddSubview (foregroundContentScrollView);

            foregroundContentScrollView.AddSubview (foregroundContentView);

            foregroundContentView.ContentView.AddSubview (hueLabel);
            foregroundContentView.ContentView.AddSubview (hueSlider);

            foregroundContentView.ContentView.AddSubview (saturationLabel);
            foregroundContentView.ContentView.AddSubview (saturationSlider);

            foregroundContentView.ContentView.AddSubview (brightnessLabel);
            foregroundContentView.ContentView.AddSubview (brightnessSlider);

            foregroundContentView.ContentView.AddSubview (saveButton);

            foregroundContentScrollView.AddSubview (imageView);

            View.AddConstraints (NSLayoutConstraint.FromVisualFormat ("H:|[backgroundView]|",
                (NSLayoutFormatOptions)0,
                "backgroundView", backgroundView));
            View.AddConstraints (NSLayoutConstraint.FromVisualFormat("V:|[backgroundView]|",
                (NSLayoutFormatOptions)0,
                "backgroundView", backgroundView));

            View.AddConstraints (NSLayoutConstraint.FromVisualFormat ("H:|[foregroundContentScrollView]|",
                (NSLayoutFormatOptions)0,
                "foregroundContentScrollView", foregroundContentScrollView));
            View.AddConstraints (NSLayoutConstraint.FromVisualFormat ("V:|[foregroundContentScrollView]|",
                (NSLayoutFormatOptions)0,
                "foregroundContentScrollView", foregroundContentScrollView));

            View.AddConstraints (NSLayoutConstraint.FromVisualFormat ("H:|[foregroundContentView]|",
                (NSLayoutFormatOptions)0,
                "foregroundContentView", foregroundContentView));
            View.AddConstraints (NSLayoutConstraint.FromVisualFormat ("V:|[foregroundContentView]|",
                (NSLayoutFormatOptions)0,
                "foregroundContentView", foregroundContentView));

            View.AddConstraints (NSLayoutConstraint.FromVisualFormat ("H:|-[hueLabel]-|",
                (NSLayoutFormatOptions)0,
                "hueLabel", hueLabel));
            View.AddConstraints (NSLayoutConstraint.FromVisualFormat ("H:|-[hueSlider]-|",
                (NSLayoutFormatOptions)0,
                "hueSlider", hueSlider));
            View.AddConstraints (NSLayoutConstraint.FromVisualFormat ("H:|-[saturationLabel]-|",
                (NSLayoutFormatOptions)0,
                "saturationLabel", saturationLabel));
            View.AddConstraints (NSLayoutConstraint.FromVisualFormat ("H:|-[saturationSlider]-|",
                (NSLayoutFormatOptions)0,
                "saturationSlider", saturationSlider));
            View.AddConstraints (NSLayoutConstraint.FromVisualFormat ("H:|-[brightnessLabel]-|",
                (NSLayoutFormatOptions)0,
                "brightnessLabel", brightnessLabel));
            View.AddConstraints (NSLayoutConstraint.FromVisualFormat ("H:|-[brightnessSlider]-|",
                (NSLayoutFormatOptions)0,
                "brightnessSlider", brightnessSlider));
            View.AddConstraints (NSLayoutConstraint.FromVisualFormat ("H:|-[saveButton]-|",
                (NSLayoutFormatOptions)0,
                "saveButton", saveButton));
            View.AddConstraints (NSLayoutConstraint.FromVisualFormat ("H:|[imageView(==foregroundContentScrollView)]|",
                (NSLayoutFormatOptions)0,
                "imageView", imageView,
                "foregroundContentScrollView", foregroundContentScrollView));
            View.AddConstraints (NSLayoutConstraint.FromVisualFormat ("V:|-(>=30)-[hueLabel]-[hueSlider]-[saturationLabel]-[saturationSlider]-[brightnessLabel]-[brightnessSlider]-[saveButton]-(>=10)-[imageView(==200)]|",
                (NSLayoutFormatOptions)0,
                "hueLabel", hueLabel,
                "hueSlider", hueSlider,
                "saturationLabel", saturationLabel,
                "saturationSlider", saturationSlider,
                "brightnessLabel", brightnessLabel,
                "brightnessSlider", brightnessSlider,
                "saveButton", saveButton,
                "imageView", imageView));
        }