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

            _stackView = new UIStackView
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Spacing = 5,
            };

            _keyLabel   = new UILabel();
            _valueLabel = new UILabel();

            this.DelayBind(() =>
            {
                var set = this.CreateBindingSet <WeatherItemCell, WeatherItem>();
                set.Bind(_keyLabel)
                .For(x => x.Text)
                .To(x => x.Title);
                set.Bind(_valueLabel)
                .For(x => x.Text)
                .To(x => x.Value);
                set.Apply();
            });

            ContentView.AddSubview(_stackView);

            _stackView.Axis = UILayoutConstraintAxis.Horizontal;
            _stackView.AddArrangedSubview(_keyLabel);
            _stackView.AddArrangedSubview(_valueLabel);
            _stackView.Alignment    = UIStackViewAlignment.Fill;
            _stackView.Distribution = UIStackViewDistribution.FillEqually;

            ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
        }
        public override void LoadView()
        {
            // Create the views.
            View = new UIView()
            {
                BackgroundColor = ApplicationTheme.BackgroundColor
            };

            _stackView = new UIStackView
            {
                Axis         = UILayoutConstraintAxis.Vertical,
                Alignment    = UIStackViewAlignment.Fill,
                Distribution = UIStackViewDistribution.FillEqually,
                TranslatesAutoresizingMaskIntoConstraints = false
            };

            _myMapView = new MapView();
            _stackView.AddArrangedSubview(_myMapView);

            _tableView = new UITableView();
            _stackView.AddArrangedSubview(_tableView);

            // Add the views.
            View.AddSubviews(_stackView);

            // Lay out the views.
            NSLayoutConstraint.ActivateConstraints(new[]
            {
                _stackView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor),
                _stackView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor),
                _stackView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor),
                _stackView.BottomAnchor.ConstraintEqualTo(View.BottomAnchor),
            });
        }
        private void CreateLayout()
        {
            nfloat topHeight = NavigationController.TopLayoutGuide.Length + 60;

            //set up UIStackView for laying out controls
            _stackView                 = new UIStackView(new CoreGraphics.CGRect(0, topHeight, View.Bounds.Width, 150));
            _stackView.Axis            = UILayoutConstraintAxis.Vertical;
            _stackView.Alignment       = UIStackViewAlignment.Fill;
            _stackView.Distribution    = UIStackViewDistribution.FillProportionally;
            _stackView.BackgroundColor = UIColor.Gray;

            // Add the views to the UIStackView
            _stackView.AddArrangedSubview(_redLabel);
            _stackView.AddArrangedSubview(_blueLabel);
            _stackView.AddArrangedSubview(_timeLabel);
            _stackView.AddArrangedSubview(_timeSlider);

            // Add MapView to the page
            View.AddSubviews(_myMapView);

            // Add UIStackView to the page
            View.AddSubviews(_stackView);

            // Subscribe to slider value change notifications
            _timeSlider.ValueChanged += _timeSlider_ValueChanged;
        }
Esempio n. 4
0
        public override void OnInitializeTextField()
        {
            base.OnInitializeTextField();
            ResultView       = new UIStackView();
            ResultView.Axis  = UILayoutConstraintAxis.Vertical;
            ResultView.Frame = this.Bounds;

            CollectionResult   = new UICollectionView(this.Bounds, new CollectionViewLeftFlowLayout());
            HeightOfCollection = NSLayoutConstraint.Create(CollectionResult, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1, 0);
            CollectionResult.AddConstraint(HeightOfCollection);

            ResultView.AddArrangedSubview(textField);
            ResultView.AddArrangedSubview(CollectionResult);

            CollectionResult.RegisterClassForCell(typeof(CollectionItemMultiCell), CellId);
            CollectionResultSource  = new CollectionResultSource(ResultItems);
            CollectionResult.Source = CollectionResultSource;

            CollectionMultiDelegate   = new CollectionMultiDelegate(ResultItems, CollectionResult.Frame.Width);
            CollectionResult.Delegate = CollectionMultiDelegate;

            CollectionViewLeftFlowLayout = new CollectionViewLeftFlowLayout();
            CollectionViewLeftFlowLayout.MinimumLineSpacing = 5f;
            CollectionResult.CollectionViewLayout           = CollectionViewLeftFlowLayout;

            uITapGestureRecognizer = new UITapGestureRecognizer(() =>
            {
                GestureAction(uITapGestureRecognizer);
            });
            uITapGestureRecognizer.NumberOfTapsRequired = 1;
            CollectionResult.UserInteractionEnabled     = true;
            CollectionResult.AddGestureRecognizer(uITapGestureRecognizer);
            CollectionResult.ReloadData();
        }
        protected override void OnPrepareUIElements()
        {
            _stackView = new UIStackView()
            {
                Axis         = UILayoutConstraintAxis.Vertical,
                Distribution = UIStackViewDistribution.EqualSpacing,
            };

            View.AddSubview(_stackView);
            AutoLayoutToolBox.AlignToFullConstraints(_stackView, View);

            var transitionButton = new UIButton(UIButtonType.System);

            transitionButton.SetTitle("Transition", UIControlState.Normal);
            transitionButton.TouchUpInside += (sender, e) =>
            {
                NavigationController.PushViewController(new InnerViewController1(), true);
            };

            _stackView.AddArrangedSubview(transitionButton);

            var translucentButton = new UIButton(UIButtonType.System);

            translucentButton.SetTitle("Translucent", UIControlState.Normal);
            translucentButton.TouchUpInside += (sender, e) =>
            {
                NavigationController.PushViewController(new Page1Translucent(), true);
            };

            _stackView.AddArrangedSubview(transitionButton);
        }
Esempio n. 6
0
        private UIView CreateActionItem(ActionSheetOption option)
        {
            var view = new UIStackView
            {
                Alignment        = UIStackViewAlignment.Center,
                AutoresizingMask = UIViewAutoresizing.All,
                Distribution     = UIStackViewDistribution.Fill,
                Axis             = UILayoutConstraintAxis.Horizontal
            };

            var tap = new UITapGestureRecognizer(() =>
            {
                try
                {
                    option.Action();
                }
                catch (Exception e)
                {
                    System.Diagnostics.Debug.WriteLine("ActionSheet in action (" + option.Text + ") exception: " + e);
                }
                finally
                {
                    this.DismissController();
                }
            });

            view.AddGestureRecognizer(tap);

            if (option.ItemIcon != null)
            {
                var image = UIImage.FromImage(option.ItemIcon.ToNative().CGImage);

                var imageView = new UIImageView
                {
                    Image              = image,
                    BackgroundColor    = UIColor.Clear,
                    ContentMode        = UIViewContentMode.Center,
                    ContentScaleFactor = 2
                };

                imageView.HeightAnchor.ConstraintEqualTo(RowHeight).Active = true;
                imageView.WidthAnchor.ConstraintEqualTo(RowHeight).Active  = true;

                view.AddArrangedSubview(imageView);
            }

            var textView = new UILabel
            {
                Text            = option.Text,
                BackgroundColor = UIColor.Clear,
                TextColor       = MainTextUiColor,
                TextAlignment   = UITextAlignment.Left
            };

            textView.HeightAnchor.ConstraintEqualTo(RowHeight).Active = true;

            view.AddArrangedSubview(textView);

            return(view);
        }
Esempio n. 7
0
        protected AlbumTableViewCell(IntPtr handle) : base(handle)
        {
            _lastImage               = new UIImageView();
            _lastImage.ContentMode   = UIViewContentMode.ScaleAspectFill;
            _lastImage.ClipsToBounds = true;
            ContentView.AddSubview(_lastImage);
            _lastImage.AutoSetDimensionsToSize(new CGSize(80, 80));
            _lastImage.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 10);
            _lastImage.AutoAlignAxisToSuperviewAxis(ALAxis.Horizontal);

            var container = new UIStackView();

            container.Axis = UILayoutConstraintAxis.Vertical;
            ContentView.AddSubview(container);
            container.AutoAlignAxis(ALAxis.Horizontal, _lastImage);
            container.AutoPinEdge(ALEdge.Left, ALEdge.Right, _lastImage, 10);
            container.AutoPinEdgeToSuperviewEdge(ALEdge.Right);

            _name      = new UILabel();
            _name.Font = Constants.Regular16;
            container.AddArrangedSubview(_name);

            _count      = new UILabel();
            _count.Font = Constants.Regular14;
            container.AddArrangedSubview(_count);

            var tapGesture = new UITapGestureRecognizer(() =>
            {
                CellAction?.Invoke(ActionType.Tap, _currentAlbum);
            });

            ContentView.AddGestureRecognizer(tapGesture);
            ContentView.UserInteractionEnabled = true;
        }
Esempio n. 8
0
 protected void AddSpacing(int height)
 {
     StackView.AddArrangedSubview(new UIView()
     {
         TranslatesAutoresizingMaskIntoConstraints = false
     }.SetHeight(height));
 }
Esempio n. 9
0
        private void CreateLayout()
        {
            nfloat height = 80;

            //set up UIStackView for laying out controls
            var stackView = new UIStackView(new CoreGraphics.CGRect(0, 0, View.Bounds.Width, View.Bounds.Height));

            stackView.Axis            = UILayoutConstraintAxis.Vertical;
            stackView.Alignment       = UIStackViewAlignment.Fill;
            stackView.Distribution    = UIStackViewDistribution.FillProportionally;
            stackView.BackgroundColor = UIColor.Gray;

            // Setup the visual frame for the MapView
            _myMapView = new MapView()
            {
                Frame = new CoreGraphics.CGRect(0, 0, View.Bounds.Width, View.Bounds.Height - 80)
            };

            stackView.AddArrangedSubview(_myMapView);

            // Create a tableview for displaying layer view status for each layer
            _tableView = new UITableView(new CoreGraphics.CGRect(0, _myMapView.Frame.Height, View.Bounds.Width, height));
            stackView.AddArrangedSubview(_tableView);

            // Add MapView to the page
            View.AddSubviews(stackView);
        }
Esempio n. 10
0
        public override void LoadView()
        {
            // Create the views.
            View = new UIView {
                BackgroundColor = ApplicationTheme.BackgroundColor
            };

            _outerStackView      = new UIStackView();
            _outerStackView.Axis = UILayoutConstraintAxis.Vertical;
            _outerStackView.TranslatesAutoresizingMaskIntoConstraints = false;
            _outerStackView.Spacing   = 8;
            _outerStackView.Alignment = UIStackViewAlignment.Top;

            UILabel startLabel = new UILabel();

            startLabel.TranslatesAutoresizingMaskIntoConstraints = false;
            startLabel.Text = "Start date:";

            StartPicker.TranslatesAutoresizingMaskIntoConstraints = false;
            StartPicker.Mode = UIDatePickerMode.Date;

            UIStackView startStack = new UIStackView(new UIView[] { startLabel, StartPicker });

            startStack.TranslatesAutoresizingMaskIntoConstraints = false;
            startStack.Axis = UILayoutConstraintAxis.Vertical;
            _outerStackView.AddArrangedSubview(startStack);

            UILabel endLabel = new UILabel();

            endLabel.TranslatesAutoresizingMaskIntoConstraints = false;
            endLabel.Text = "End date:";

            EndPicker.TranslatesAutoresizingMaskIntoConstraints = false;
            EndPicker.Mode = UIDatePickerMode.Date;

            UIStackView endStack = new UIStackView(new UIView[] { endLabel, EndPicker });

            endStack.TranslatesAutoresizingMaskIntoConstraints = false;
            endStack.Axis = UILayoutConstraintAxis.Vertical;
            _outerStackView.AddArrangedSubview(endStack);

            UIView spacer = new UIView();

            spacer.TranslatesAutoresizingMaskIntoConstraints = false;
            spacer.SetContentHuggingPriority((float)UILayoutPriority.DefaultLow, UILayoutConstraintAxis.Vertical);
            spacer.SetContentHuggingPriority((float)UILayoutPriority.DefaultLow, UILayoutConstraintAxis.Horizontal);
            _outerStackView.AddArrangedSubview(spacer);

            // Add the views.
            View.AddSubview(_outerStackView);

            // Lay out the views.
            NSLayoutConstraint.ActivateConstraints(new[]
            {
                _outerStackView.LeadingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.LeadingAnchor, 8),
                _outerStackView.TrailingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TrailingAnchor, -8),
                _outerStackView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor, 8),
                _outerStackView.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor, -8)
            });
        }
Esempio n. 11
0
        public override void LoadView()
        {
            // Create a UIStackView for laying out the map view and table view.
            _stackView = new UIStackView()
            {
                Axis         = UILayoutConstraintAxis.Vertical,
                Alignment    = UIStackViewAlignment.Fill,
                Distribution = UIStackViewDistribution.FillEqually,
                TranslatesAutoresizingMaskIntoConstraints = false
            };

            // Create the map view and add it to the stack view.
            _myMapView = new MapView();
            _stackView.AddArrangedSubview(_myMapView);

            // Create a table view for displaying records from the comments table.
            _tableView = new UITableView();
            _stackView.AddArrangedSubview(_tableView);

            // Add the stack view to the page.
            View = new UIView();
            View.AddSubviews(_stackView);

            _stackView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor).Active = true;
            _stackView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor).Active             = true;
            _stackView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor).Active           = true;
            _stackView.BottomAnchor.ConstraintEqualTo(View.BottomAnchor).Active = true;
        }
Esempio n. 12
0
        void Sample5()
        {
            _container = new UIStackView {
                Axis         = UILayoutConstraintAxis.Horizontal, //並べる方向
                Alignment    = UIStackViewAlignment.Center,       //垂直位置属性
                Distribution = UIStackViewDistribution.Fill,      //余白分配設定
            };

            _container.AddArrangedSubview(_label1);

            //分けたいところにダミーを追加
            var dummy = new UIView();

            _container.AddArrangedSubview(dummy);

            _container.AddArrangedSubview(_label2);
            _container.AddArrangedSubview(_label3);


            //余った領域を広げる優先度の設定(低いものが優先して拡大する)
            _label1.SetContentHuggingPriority(999f, UILayoutConstraintAxis.Horizontal);
            dummy.SetContentHuggingPriority(1f, UILayoutConstraintAxis.Horizontal); //最優先
            _label2.SetContentHuggingPriority(999f, UILayoutConstraintAxis.Horizontal);
            _label3.SetContentHuggingPriority(999f, UILayoutConstraintAxis.Horizontal);
        }
Esempio n. 13
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _stackView = new UIStackView
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Axis         = UILayoutConstraintAxis.Vertical,
                Alignment    = UIStackViewAlignment.Fill,
                Distribution = UIStackViewDistribution.EqualSpacing,
                Spacing      = 1
            };

            var scroll = new UIScrollView();

            Add(scroll);

            scroll.AddSubview(_stackView);
            scroll.FullSizeOf(View);
            scroll.EnableAutoLayout();

            _stackView.FullSizeOf(scroll);
            _stackView.WidthAnchor
            .ConstraintEqualTo(scroll.WidthAnchor)
            .Active = true;

            for (var i = 0; i < 25; i++)
            {
                _stackView.AddArrangedSubview(
                    GetButton($"Category {i + 1}", i));

                _stackView.AddArrangedSubview(
                    GetContent($"Child of category {i + 1}", i + 100));
            }
        }
Esempio n. 14
0
        void Sample12()
        {
            _container = new UIStackView {
                Axis         = UILayoutConstraintAxis.Horizontal,   //並べる方向
                Alignment    = UIStackViewAlignment.Fill,           //垂直位置属性
                Distribution = UIStackViewDistribution.FillEqually, //余白分配設定 均等
            };

            //ラッパーのUIStackViewを作成する(それぞれ垂直属性を変える)
            var wrapper1 = new UIStackView {
                Alignment = UIStackViewAlignment.Top
            };
            var wrapper2 = new UIStackView {
                Alignment = UIStackViewAlignment.Bottom
            };
            var wrapper3 = new UIStackView {
                Alignment = UIStackViewAlignment.Center
            };

            //ラッパーに要素を詰める
            wrapper1.AddArrangedSubview(_label1);
            wrapper2.AddArrangedSubview(_label2);
            wrapper3.AddArrangedSubview(_label3);

            _container.AddArrangedSubview(wrapper1);
            _container.AddArrangedSubview(wrapper2);
            _container.AddArrangedSubview(wrapper3);
        }
        public static void ConfigureUI(UIStackView stackView)
        {
            AddHeader(stackView, "Version");
            AddText(stackView, Variables.VERSION.ToString());

            AddHeader(stackView, "Developer");
            AddText(stackView, "BareBones Dev, owned by Andrew Bares");

            AddHeader(stackView, "About the App");
            AddText(stackView, PowerPlannerResources.GetString("Settings_AboutPage_AboutAppValue.Text"));

            AddHeader(stackView, "Contact");

            var buttonContact = new UIButton(UIButtonType.System)
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                HorizontalAlignment = UIControlContentHorizontalAlignment.Left
            };

            buttonContact.SetTitle("*****@*****.**", UIControlState.Normal);
            buttonContact.TouchUpInside += ButtonContact_TouchUpInside;
            stackView.AddArrangedSubview(buttonContact);
            buttonContact.StretchWidth(stackView);

            var buttonFacebook = new UIButton(UIButtonType.System)
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                HorizontalAlignment = UIControlContentHorizontalAlignment.Left
            };

            buttonFacebook.SetTitle("Facebook page", UIControlState.Normal);
            buttonFacebook.TouchUpInside += ButtonFacebook_TouchUpInside;
            stackView.AddArrangedSubview(buttonFacebook);
            buttonFacebook.StretchWidth(stackView);
        }
Esempio n. 16
0
        public ItemCell(CGRect frame) : base(frame)
        {
            stackView = new UIStackView(ContentView.Frame)
            {
                Axis         = UILayoutConstraintAxis.Vertical,
                Alignment    = UIStackViewAlignment.Fill,
                Distribution = UIStackViewDistribution.Fill,
                //Spacing = 10,
                TranslatesAutoresizingMaskIntoConstraints = false
            };
            MainLabel = new UILabel
            {
                TextColor     = UIColor.DarkGray,
                TextAlignment = UITextAlignment.Center,
                TranslatesAutoresizingMaskIntoConstraints = false
            };

            //MainLabel.LineBreakMode = UILineBreakMode.WordWrap;
            //MainLabel.MinimumScaleFactor = 1;
            //MainLabel.AdjustsFontSizeToFitWidth = true;
            MainLabel.Lines = 2;

            SecondLabel = new UILabel
            {
                BackgroundColor = UIColor.FromRGB(66, 165, 245),
                TextColor       = UIColor.White,
                TextAlignment   = UITextAlignment.Center,
                TranslatesAutoresizingMaskIntoConstraints = false,
            };

            IDLabel = new UILabel
            {
                BackgroundColor = UIColor.FromRGB(66, 165, 245),
                TextColor       = UIColor.White,
                TextAlignment   = UITextAlignment.Center,
                TranslatesAutoresizingMaskIntoConstraints = false,
                Hidden = true
            };

            MainLabel.Layer.CornerRadius   = 10.0f;
            SecondLabel.Layer.CornerRadius = 10.0f;

            stackView.AddArrangedSubview(SecondLabel);
            stackView.AddArrangedSubview(MainLabel);
            stackView.AddArrangedSubview(IDLabel);
            ContentView.AddSubview(stackView);
            SecondLabel.HeightAnchor.ConstraintEqualTo(20).Active = true;
            SecondLabel.LeadingAnchor.ConstraintEqualTo(ContentView.LeadingAnchor).Active   = true;
            SecondLabel.BottomAnchor.ConstraintEqualTo(ContentView.BottomAnchor).Active     = true;
            SecondLabel.TrailingAnchor.ConstraintEqualTo(ContentView.TrailingAnchor).Active = true;

            MainLabel.LeadingAnchor.ConstraintEqualTo(ContentView.LeadingAnchor).Active   = true;
            MainLabel.TrailingAnchor.ConstraintEqualTo(ContentView.TrailingAnchor).Active = true;
            MainLabel.TopAnchor.ConstraintEqualTo(ContentView.TopAnchor).Active           = true;
            MainLabel.BottomAnchor.ConstraintEqualTo(SecondLabel.TopAnchor).Active        = true;

            ContentView.Layer.BorderColor = UIColor.Gray.CGColor;
            ContentView.Layer.BorderWidth = 1.0f;
            //ContentView.Layer.CornerRadius = 10.0f;
        }
        private UIStackView getCheckRow(string label, EventHandler checkboxChecked)
        {
            UIStackView rowView = new UIStackView();

            rowView.TranslatesAutoresizingMaskIntoConstraints = false;
            rowView.Axis         = UILayoutConstraintAxis.Horizontal;
            rowView.Alignment    = UIStackViewAlignment.Center;
            rowView.Distribution = UIStackViewDistribution.Fill;
            rowView.Spacing      = 5;
            rowView.LayoutMarginsRelativeArrangement = true;
            rowView.LayoutMargins = new UIEdgeInsets(0, 0, 0, 5);

            UILabel descriptionLabel = new UILabel();

            descriptionLabel.TranslatesAutoresizingMaskIntoConstraints = false;
            descriptionLabel.Text = label;
            rowView.AddArrangedSubview(descriptionLabel);

            UISwitch valueSwitch = new UISwitch();

            valueSwitch.TranslatesAutoresizingMaskIntoConstraints = false;
            valueSwitch.ValueChanged += checkboxChecked;
            rowView.AddArrangedSubview(valueSwitch);

            return(rowView);
        }
                public UITimeView()
                {
                    base.TranslatesAutoresizingMaskIntoConstraints = false;

                    _stackView = new UIStackView()
                    {
                        Axis = UILayoutConstraintAxis.Vertical,
                        TranslatesAutoresizingMaskIntoConstraints = false
                    };

                    _labelTime = new UILabel()
                    {
                        TranslatesAutoresizingMaskIntoConstraints = false,
                        Font = UIFont.PreferredCaption1
                    };
                    _stackView.AddArrangedSubview(_labelTime);
                    _labelTime.StretchWidth(_stackView);

                    _labelRoom = new UILabel()
                    {
                        TranslatesAutoresizingMaskIntoConstraints = false,
                        Font = UIFont.PreferredCaption1
                    };
                    _stackView.AddArrangedSubview(_labelRoom);
                    _labelRoom.StretchWidth(_stackView);

                    base.AddSubview(_stackView);
                    _stackView.StretchWidthAndHeight(this);
                }
        public override void LoadView()
        {
            // Create and add the container views.
            View = new UIView()
            {
                BackgroundColor = UIColor.Gray
            };

            UIStackView formContainer = new UIStackView
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Spacing = 8,
                LayoutMarginsRelativeArrangement = true,
                Alignment     = UIStackViewAlignment.Fill,
                LayoutMargins = new UIEdgeInsets(8, 8, 8, 8),
                Axis          = UILayoutConstraintAxis.Vertical
            };

            formContainer.WidthAnchor.ConstraintEqualTo(300).Active = true;

            elevationLabel = new UILabel
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Text = "Elevation"
            };

            elevationSlider = new UISlider {
                MinValue = -10, MaxValue = 10, Value = 0
            };
            elevationSlider.TranslatesAutoresizingMaskIntoConstraints = false;
            formContainer.AddArrangedSubview(GetRowStackView(new UIView[] { elevationSlider, elevationLabel }));

            headingLabel = new UILabel
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Text = "Heading"
            };

            headingSlider = new UISlider {
                MinValue = -10, MaxValue = 10, Value = 0
            };
            headingSlider.TranslatesAutoresizingMaskIntoConstraints = false;
            formContainer.AddArrangedSubview(GetRowStackView(new UIView[] { headingSlider, headingLabel }));

            bufferLabel = new UILabel
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Text = $"Buffer: {(int)locationSource.DistanceBuffer}km"
            };

            bufferSlider = new UISlider {
                MinValue = 25, MaxValue = 500, Value = this.locationSource.DistanceBuffer
            };
            bufferSlider.TranslatesAutoresizingMaskIntoConstraints = false;
            formContainer.AddArrangedSubview(GetRowStackView(new UIView[] { bufferSlider, bufferLabel }));

            // Lay out container and scroll view.
            View.AddSubview(formContainer);
        }
Esempio n. 20
0
 private void AddArrangedSubCell(UIStackView sv, UIView tx, nfloat w, nfloat h)
 {
     tx.WidthAnchor.ConstraintEqualTo(w - 4).Active = true;
     tx.HeightAnchor.ConstraintEqualTo(h).Active    = true;
     sv.AddArrangedSubview(VerticalBorder());
     sv.AddArrangedSubview(tx);
     sv.AddArrangedSubview(VerticalBorder());
 }
Esempio n. 21
0
 private void SetHierarchy()
 {
     Add(_topHorizontalStack);
     _topHorizontalStack.AddArrangedSubview(_myHomeLabel);
     _topHorizontalStack.AddArrangedSubview(_settingsButton);
     Add(_myHomeDescriptionText);
     Add(HomeTableView);
 }
Esempio n. 22
0
 private void SetHierarchy()
 {
     Add(_textStack);
     _textStack.AddArrangedSubview(_titleLabel);
     _textStack.AddArrangedSubview(_subTextLabel);
     Add(_rowStack);
     _rowStack.AddArrangedSubview(_textStack);
     _rowStack.AddArrangedSubview(_cellIconView);
 }
        public override void LoadView()
        {
            View = new UIView()
            {
                BackgroundColor = UIColor.White
            };

            UIScrollView scrollView = new UIScrollView();

            scrollView.TranslatesAutoresizingMaskIntoConstraints = false;

            View.AddSubviews(scrollView);

            scrollView.TopAnchor.ConstraintEqualTo(View.TopAnchor).Active           = true;
            scrollView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor).Active   = true;
            scrollView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor).Active = true;
            scrollView.BottomAnchor.ConstraintEqualTo(View.BottomAnchor).Active     = true;

            UIStackView formContainer = new UIStackView();

            formContainer.TranslatesAutoresizingMaskIntoConstraints = false;
            formContainer.Spacing = 8;
            formContainer.LayoutMarginsRelativeArrangement = true;
            formContainer.Alignment     = UIStackViewAlignment.Fill;
            formContainer.LayoutMargins = new UIEdgeInsets(8, 8, 8, 8);
            formContainer.Axis          = UILayoutConstraintAxis.Vertical;

            // Add controls here.
            UILabel minLabel = new UILabel();

            minLabel.TranslatesAutoresizingMaskIntoConstraints = false;
            minLabel.Text = "Minimum:";
            _minSlider    = new UISlider();
            _minSlider.TranslatesAutoresizingMaskIntoConstraints = false;
            _minSlider.MinValue = 0;
            _minSlider.MaxValue = 100;
            formContainer.AddArrangedSubview(getRowStackView(new UIView[] { minLabel, _minSlider }));
            UILabel maxLabel = new UILabel();

            maxLabel.TranslatesAutoresizingMaskIntoConstraints = false;
            maxLabel.Text = "Maximum:";
            _maxSlider    = new UISlider();
            _maxSlider.TranslatesAutoresizingMaskIntoConstraints = false;
            _maxSlider.MinValue = 0;
            _maxSlider.MaxValue = 100;
            formContainer.AddArrangedSubview(getRowStackView(new UIView[] { maxLabel, _maxSlider }));

            NavigationItem.RightBarButtonItem = new UIBarButtonItem("Apply", UIBarButtonItemStyle.Plain, ApplyButton_Clicked);

            scrollView.AddSubview(formContainer);

            formContainer.TopAnchor.ConstraintEqualTo(scrollView.TopAnchor).Active           = true;
            formContainer.LeadingAnchor.ConstraintEqualTo(scrollView.LeadingAnchor).Active   = true;
            formContainer.TrailingAnchor.ConstraintEqualTo(scrollView.TrailingAnchor).Active = true;
            formContainer.BottomAnchor.ConstraintEqualTo(scrollView.BottomAnchor).Active     = true;
            formContainer.WidthAnchor.ConstraintEqualTo(scrollView.WidthAnchor).Active       = true;
        }
Esempio n. 24
0
        private UIView CreateOkCancelButtonsView(Action <bool> action, string okText = null, string cancelText = null)
        {
            var stack = new UIStackView()
            {
                Alignment        = UIStackViewAlignment.Fill,
                AutoresizingMask = UIViewAutoresizing.All,
                Distribution     = UIStackViewDistribution.Fill,
                Axis             = UILayoutConstraintAxis.Horizontal
            };

            stack.HeightAnchor.ConstraintEqualTo(ButtonRowHeight).Active = true;

            var okButton = new UIButton {
                BackgroundColor = UIColor.Clear
            };

            okButton.SetTitle(okText ?? "OK", UIControlState.Normal);
            okButton.SetTitleColor(ButtonTextUiColor, UIControlState.Normal);
            okButton.AddTarget((x, y) =>
            {
                try
                {
                    action(true);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
                finally
                {
                    DismissController();
                }
            }, UIControlEvent.TouchUpInside);
            okButton.WidthAnchor.ConstraintEqualTo(TopController.View.Frame.Width / 2 - 1).Active = true;

            //var separator = new UIView {BackgroundColor = SeparatorColor};
            //separator.WidthAnchor.ConstraintEqualTo(1).Active = true;

            var cancelButton = new UIButton {
                BackgroundColor = UIColor.Clear
            };

            cancelButton.SetTitle((string.IsNullOrEmpty(cancelText) ? "Cancel" : cancelText), UIControlState.Normal);
            cancelButton.SetTitleColor(ButtonTextUiColor, UIControlState.Normal);
            cancelButton.AddTarget((x, y) =>
            {
                DismissController();
            }, UIControlEvent.TouchUpInside);
            okButton.WidthAnchor.ConstraintEqualTo(TopController.View.Frame.Width / 2).Active = true;

            stack.AddArrangedSubview(okButton);
            //stack.AddArrangedSubview(separator);
            stack.AddArrangedSubview(cancelButton);

            return(stack);
        }
Esempio n. 25
0
        void Sample6()
        {
            _container = new UIStackView {
                Axis         = UILayoutConstraintAxis.Horizontal,   //並べる方向
                Alignment    = UIStackViewAlignment.Center,         //垂直位置属性
                Distribution = UIStackViewDistribution.FillEqually, //余白分配設定 均等
            };

            _container.AddArrangedSubview(_label1);
            _container.AddArrangedSubview(_label2);
            _container.AddArrangedSubview(_label3);
        }
Esempio n. 26
0
        private void AddHeaderLabel(string title)
        {
            var label = new UILabel
            {
                Text          = title,
                Lines         = 0,
                LineBreakMode = UILineBreakMode.WordWrap,
                Font          = UIFont.PreferredHeadline
            };

            _stackView.AddArrangedSubview(label);
        }
        public override void LoadView()
        {
            View = new UIView()
            {
                BackgroundColor = UIColor.White
            };

            UIScrollView scrollView = new UIScrollView();

            scrollView.TranslatesAutoresizingMaskIntoConstraints = false;

            View.AddSubviews(scrollView);

            scrollView.TopAnchor.ConstraintEqualTo(View.TopAnchor).Active           = true;
            scrollView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor).Active   = true;
            scrollView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor).Active = true;
            scrollView.BottomAnchor.ConstraintEqualTo(View.BottomAnchor).Active     = true;

            UIStackView formContainer = new UIStackView();

            formContainer.TranslatesAutoresizingMaskIntoConstraints = false;
            formContainer.Spacing = 8;
            formContainer.LayoutMarginsRelativeArrangement = true;
            formContainer.Alignment     = UIStackViewAlignment.Center;
            formContainer.LayoutMargins = new UIEdgeInsets(8, 8, 8, 8);
            formContainer.Axis          = UILayoutConstraintAxis.Vertical;

            // Add controls here.
            UILabel factorLabel = new UILabel();

            factorLabel.TranslatesAutoresizingMaskIntoConstraints = false;
            factorLabel.Text = "Factor:";
            formContainer.AddArrangedSubview(factorLabel);

            UIPickerView picker = new UIPickerView();

            picker.TranslatesAutoresizingMaskIntoConstraints = false;
            _pickerModel = new StdDevFactorPickerModel();
            picker.Model = _pickerModel;
            picker.HeightAnchor.ConstraintEqualTo(90).Active = true;
            formContainer.AddArrangedSubview(picker);

            NavigationItem.RightBarButtonItem = new UIBarButtonItem("Apply", UIBarButtonItemStyle.Plain, ApplyButton_Clicked);

            scrollView.AddSubview(formContainer);

            formContainer.TopAnchor.ConstraintEqualTo(scrollView.TopAnchor).Active           = true;
            formContainer.LeadingAnchor.ConstraintEqualTo(scrollView.LeadingAnchor).Active   = true;
            formContainer.TrailingAnchor.ConstraintEqualTo(scrollView.TrailingAnchor).Active = true;
            formContainer.BottomAnchor.ConstraintEqualTo(scrollView.BottomAnchor).Active     = true;
            formContainer.WidthAnchor.ConstraintEqualTo(scrollView.WidthAnchor).Active       = true;
        }
Esempio n. 28
0
        public void InitWithFrameTest()
        {
            TestRuntime.AssertSystemVersion(PlatformName.iOS, 9, 0, throwIfOtherPlatform: false);

            UIStackView stack = new UIStackView(new CGRect(0, 0, 10, 10));

            Assert.NotNull(stack, "UIStackView ctor(CGRect)");

            stack.AddArrangedSubview(new UIImageView());
            stack.AddArrangedSubview(new UIView());

            Assert.That(stack.Subviews.Length, Is.EqualTo(2), "UIStackView instance is not usable ");
        }
Esempio n. 29
0
        void Initialize()
        {
            BackgroundColor = UIColor.Red;

            PushPageButton = new UIButton(UIButtonType.System);
            //PushPageButton.Frame = new CGRect(25, 25, 300, 150);
            PushPageButton.SetTitle("Push Page!", UIControlState.Normal);
            PushPageButton.SetTitleShadowColor(UIColor.Black, UIControlState.Normal);
            PushPageButton.BackgroundColor = UIColor.Orange;
            PushPageButton.WidthAnchor.ConstraintEqualTo(Frame.Width).Active = true;
            PushPageButton.HeightAnchor.ConstraintEqualTo(20).Active         = true;

            PopPageButton = new UIButton(UIButtonType.System);
            //PopPageButton.Frame = new CGRect(25, 25, 300, 150);
            PopPageButton.SetTitle("Pop Page", UIControlState.Normal);
            PopPageButton.BackgroundColor = UIColor.Orange;
            PopPageButton.WidthAnchor.ConstraintEqualTo(Frame.Width).Active = true;
            PopPageButton.HeightAnchor.ConstraintEqualTo(20).Active         = true;

            PresentPageButton = new UIButton(UIButtonType.System);
            //PresentPageButton.Frame = new CGRect(25, 25, 300, 150);
            PresentPageButton.SetTitle("Present Page", UIControlState.Normal);
            PresentPageButton.BackgroundColor = UIColor.Orange;
            PresentPageButton.WidthAnchor.ConstraintEqualTo(Frame.Width).Active = true;
            PresentPageButton.HeightAnchor.ConstraintEqualTo(20).Active         = true;

            DismissPageButton = new UIButton(UIButtonType.System);
            //DismissPageButton.Frame = new CGRect(25, 25, 300, 150);
            DismissPageButton.SetTitle("Dismiss Page", UIControlState.Normal);
            DismissPageButton.BackgroundColor = UIColor.Orange;
            DismissPageButton.WidthAnchor.ConstraintEqualTo(Frame.Width).Active = true;
            DismissPageButton.HeightAnchor.ConstraintEqualTo(20).Active         = true;

            //UIStackView stackView = new UIStackView(new UIView[] { PushPageButton, PopPageButton, PresentPageButton, DismissPageButton });
            var stackView = new UIStackView(Frame);

            stackView.Axis         = UILayoutConstraintAxis.Vertical;
            stackView.Distribution = UIStackViewDistribution.EqualSpacing;
            stackView.Alignment    = UIStackViewAlignment.Center;
            stackView.Spacing      = 10;

            stackView.AddArrangedSubview(PushPageButton);
            stackView.AddArrangedSubview(PopPageButton);
            stackView.AddArrangedSubview(PresentPageButton);
            stackView.AddArrangedSubview(DismissPageButton);

            stackView.TranslatesAutoresizingMaskIntoConstraints = false;
            AddSubview(stackView);
            stackView.CenterXAnchor.ConstraintEqualTo(CenterXAnchor).Active = true;
            stackView.CenterYAnchor.ConstraintEqualTo(CenterYAnchor).Active = true;
        }
        private void CreateLayout()
        {
            // Add the views to the top UIStackView.
            _stackView.AddArrangedSubview(_redLabel);
            _stackView.AddArrangedSubview(_blueLabel);
            _stackView.AddArrangedSubview(_timeLabel);
            _stackView.AddArrangedSubview(_timeSlider);

            // Subscribe to slider value change notifications.
            _timeSlider.ValueChanged += TimeSlider_ValueChanged;

            // Add MapView to the page.
            View.AddSubviews(_myMapView, _topToolbar, _bottomToolbar, _redLabel, _blueLabel, _timeLabel, _timeSlider);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            //scrollView = stackView.Superview as UIScrollView;
            //scrollView.KeyboardDismissMode = UIScrollViewKeyboardDismissMode.OnDrag;
            //scrollView.ScrollEnabled = true;
            // Set up Navigation Bar
            var saveButton = new UIBarButtonItem (UIBarButtonSystemItem.Save, save);
            var cancelButton = new UIBarButtonItem (UIBarButtonSystemItem.Cancel, cancel);
            NavigationItem.Title = "New Medication:";
            NavigationItem.RightBarButtonItem = saveButton;
            NavigationItem.HidesBackButton = true;
            NavigationItem.LeftBarButtonItem = cancelButton;

            //NSNotificationCenter.DefaultCenter.AddObserver (this, new ObjCRuntime.Selector("keyboardDidAppear:"), UIKeyboard.DidShowNotification, null);
            //NSNotificationCenter.DefaultCenter.AddObserver (this, new ObjCRuntime.Selector ("keyboardWillDissapear:"), UIKeyboard.WillHideNotification, null);

            // Set up the date formatter
            dateFormat = new NSDateFormatter();
            dateFormat.DateStyle = NSDateFormatterStyle.None;
            dateFormat.TimeStyle = NSDateFormatterStyle.Short;

            // Set up new pet form
            nameField = new UITextField();
            nameField.Text = "Medication Name";
            nameField.BorderStyle = UITextBorderStyle.RoundedRect;
            nameField.ReturnKeyType = UIReturnKeyType.Done;

            medTypeLabel = new UILabel ();
            medTypeLabel.Text = "Type of Medication";
            medTypeButton = new UIButton (UIButtonType.RoundedRect);
            medTypeButton.AddTarget (editMedType, UIControlEvent.TouchUpInside);
            medTypeButton.SetTitle ("Pill", UIControlState.Normal);
            medTypeButton.TitleLabel.Font = medTypeButton.TitleLabel.Font.WithSize (medTypeLabel.Font.PointSize);
            medTypePicker = new UIPickerView ();
            medTypePicker.Delegate = new MedTypePickerDelegate (this);
            medTypePicker.DataSource = new MedTypePickerDataSource ();

            freqLabel = new UILabel ();
            freqLabel.Text = "Frequency";
            freqTextField = new UITextField ();
            freqTextField.Text = "1";
            freqTextField.KeyboardType = UIKeyboardType.NumberPad;
            freqTextField.BorderStyle = UITextBorderStyle.RoundedRect;
            freqTextField.Enabled = false;
            freqTextField.AddTarget (freqTextFieldChanged, UIControlEvent.EditingDidEnd | UIControlEvent.EditingDidEndOnExit);
            freqStepper = new UIStepper ();
            freqStepper.Value = 1;
            freqStepper.MinimumValue = 1;
            freqStepper.Enabled = false;
            freqStepper.AddTarget (freqStepperIncremented, UIControlEvent.ValueChanged);
            UIStackView freqStackView = new UIStackView (new UIView[] { freqTextField, freqStepper });
            freqStackView.Spacing = 8;
            freqStackView.Axis = UILayoutConstraintAxis.Horizontal;
            freqButton = new UIButton (UIButtonType.RoundedRect);
            freqButton.SetTitle ("Daily", UIControlState.Normal);
            freqButton.TitleLabel.Font = freqButton.TitleLabel.Font.WithSize (medTypeLabel.Font.PointSize);
            freqButton.AddTarget (editFrequency, UIControlEvent.TouchUpInside);
            freqPicker = new UIPickerView ();
            freqPicker.Delegate = new MedFreqPickerDelegate (this);
            freqPicker.DataSource = new MedFreqPickerDataSource ();

            timePicker = new UIDatePicker ();
            gregorian = new NSCalendar (NSCalendarType.Gregorian);
            timePicker.Date = gregorian.DateBySettingsHour (9, 0, 0, NSDate.Now, NSCalendarOptions.MatchNextTime);
            timePicker.Mode = UIDatePickerMode.Time;
            timePicker.AddTarget (timePickerChanged, UIControlEvent.AllEvents);

            UILabel timeLabel = new UILabel ();
            timeLabel.Text = "Time";
            timeButtons = new UIButton[1];
            timeDates = new NSDate[1];
            timeDates [0] = gregorian.DateBySettingsHour (9, 0, 0, NSDate.Now, NSCalendarOptions.MatchNextTime);
            timeButtons [0] = new UIButton (UIButtonType.RoundedRect);
            timeButtons [0].SetTitle ("9:00 AM", UIControlState.Normal);
            timeButtons [0].AddTarget (openTimePicker, UIControlEvent.TouchUpInside);
            timeStack = new UIStackView ();
            timeStack.Alignment = UIStackViewAlignment.Leading;
            timeStack.Distribution = UIStackViewDistribution.FillProportionally;
            timeStack.Spacing = 5;
            timeStack.Axis = UILayoutConstraintAxis.Vertical;
            timeStack.AddArrangedSubview (timeLabel);
            foreach (var button in timeButtons) {
                timeStack.AddArrangedSubview (button);
            }
            timeStack.AddArrangedSubview (timePicker);
            timePicker.Hidden = true;

            dayLabel = new UILabel ();
            dayLabel.Text = "Day";
            dayLabel.Hidden = true;
            dayButton = new UIButton (UIButtonType.RoundedRect);
            var day = gregorian.GetComponentFromDate (NSCalendarUnit.Weekday, NSDate.Now);
            dayButton.SetTitle (gregorian.WeekdaySymbols[day], UIControlState.Normal);
            dayButton.AddTarget (openDayPicker, UIControlEvent.TouchUpInside);
            dayButton.Hidden = true;
            dayPicker = new UIDatePicker ();
            dayPicker.Mode = UIDatePickerMode.Date;
            dayPicker.MinimumDate = NSDate.Now;
            dayPicker.MaximumDate = NSDate.Now.AddSeconds (604800);
            dayPicker.AddTarget (dayPickerChanged, UIControlEvent.AllEvents);
            dayPicker.Hidden = true;

            prescriptionLengthLabel = new UILabel ();
            prescriptionLengthLabel.Text = "Prescription Length";
            prescriptionLengthTextField = new UITextField ();
            prescriptionLengthTextField.Text = "20";
            prescriptionLengthTextField.AddTarget (prescriptionTextFieldChanged, UIControlEvent.EditingDidEnd | UIControlEvent.EditingDidEndOnExit);
            prescriptionLengthTextField.KeyboardType = UIKeyboardType.NumberPad;
            prescriptionLengthTextField.BorderStyle = UITextBorderStyle.RoundedRect;
            prescriptionLengthStepper = new UIStepper ();
            prescriptionLengthStepper.Value = 20;
            prescriptionLengthStepper.MinimumValue = 1;
            prescriptionLengthStepper.AddTarget (prescriptionStepperIncremented, UIControlEvent.ValueChanged);
            prescriptionDayLabel = new UILabel ();
            prescriptionDayLabel.Text = "Days";
            UIStackView prescriptionStackView = new UIStackView (new UIView[] {
                prescriptionLengthTextField,
                prescriptionLengthStepper,
                prescriptionDayLabel
            });
            prescriptionStackView.Axis = UILayoutConstraintAxis.Horizontal;
            prescriptionStackView.Alignment = UIStackViewAlignment.Leading;
            prescriptionStackView.Distribution = UIStackViewDistribution.FillProportionally;
            prescriptionStackView.Spacing = 5;

            refillsLabel = new UILabel ();
            refillsLabel.Text = "Refills Remaining";
            refillsTextField = new UITextField ();
            refillsTextField.Text = "0";
            refillsTextField.KeyboardType = UIKeyboardType.NumberPad;
            refillsTextField.BorderStyle = UITextBorderStyle.RoundedRect;
            refillsTextField.AddTarget (refillsTextFieldChanged, UIControlEvent.EditingDidEnd | UIControlEvent.EditingDidEndOnExit);
            refillsStepper = new UIStepper ();
            refillsStepper.Value = 0;
            refillsStepper.MinimumValue = 0;
            refillsStepper.AddTarget (refillsStepperIncremented, UIControlEvent.ValueChanged);
            UIStackView refillsStackView = new UIStackView (new UIView[] { refillsTextField, refillsStepper });
            refillsStackView.Spacing = 5;
            refillsStackView.Alignment = UIStackViewAlignment.Leading;
            refillsStackView.Distribution = UIStackViewDistribution.FillProportionally;
            refillsStackView.Axis = UILayoutConstraintAxis.Horizontal;

            pharmacyTextView = new UITextView ();
            pharmacyTextView.Text = "Pharmacy Address";
            pharmacyTextView.ScrollEnabled = false;
            pharmacyTextView.BackgroundColor = UIColor.LightGray;
            pharmacyTextField = new UITextField ();
            pharmacyTextField.Text = "Pharmacy Address";
            pharmacyTextField.BorderStyle = UITextBorderStyle.RoundedRect;

            // Sets up the stackview
            stackView.Spacing = 5;
            stackView.Alignment = UIStackViewAlignment.Leading;
            stackView.Distribution = UIStackViewDistribution.EqualSpacing;
            stackView.AddArrangedSubview (nameField);
            UIView spaceView = new UIView (CoreGraphics.CGRect.FromLTRB (0, 0, 50, SECTION_SPACER));
            spaceView.AddConstraint (NSLayoutConstraint.Create (spaceView, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1, SECTION_SPACER));
            stackView.AddArrangedSubview (spaceView);
            stackView.AddArrangedSubview (medTypeLabel);
            stackView.AddArrangedSubview (medTypeButton);
            stackView.AddArrangedSubview (medTypePicker);
            medTypePicker.Hidden = true;
            UIView spaceView2 = new UIView (CoreGraphics.CGRect.FromLTRB (0, 0, 50, SECTION_SPACER));
            spaceView2.AddConstraint (NSLayoutConstraint.Create (spaceView2, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1, SECTION_SPACER));
            stackView.AddArrangedSubview (spaceView2);
            stackView.AddArrangedSubview (freqLabel);
            stackView.AddArrangedSubview (freqStackView);
            stackView.AddArrangedSubview (freqButton);
            stackView.AddArrangedSubview (freqPicker);
            freqPicker.Hidden = true;
            UIView spaceView3 = new UIView (CoreGraphics.CGRect.FromLTRB (0, 0, 50, SECTION_SPACER));
            spaceView3.AddConstraint (NSLayoutConstraint.Create (spaceView3, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1, SECTION_SPACER));
            stackView.AddArrangedSubview (spaceView3);
            stackView.AddArrangedSubview (timeStack);
            stackView.AddArrangedSubview (dayLabel);
            stackView.AddArrangedSubview (dayButton);
            stackView.AddArrangedSubview (dayPicker);
            UIView spaceView4 = new UIView (CoreGraphics.CGRect.FromLTRB (0, 0, 50, SECTION_SPACER));
            spaceView4.AddConstraint (NSLayoutConstraint.Create (spaceView4, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1, SECTION_SPACER));
            stackView.AddArrangedSubview (spaceView4);
            stackView.AddArrangedSubview (prescriptionLengthLabel);
            stackView.AddArrangedSubview (prescriptionStackView);
            UIView spaceView5 = new UIView (CoreGraphics.CGRect.FromLTRB (0, 0, 50, SECTION_SPACER));
            spaceView5.AddConstraint (NSLayoutConstraint.Create (spaceView5, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1, SECTION_SPACER));
            stackView.AddArrangedSubview (spaceView5);
            stackView.AddArrangedSubview (refillsLabel);
            stackView.AddArrangedSubview (refillsStackView);
            UIView spaceView6 = new UIView (CoreGraphics.CGRect.FromLTRB (0, 0, 50, SECTION_SPACER));
            spaceView6.AddConstraint (NSLayoutConstraint.Create (spaceView6, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1, SECTION_SPACER));
            stackView.AddArrangedSubview (spaceView6);
            stackView.AddArrangedSubview (pharmacyTextField);
            UIView spaceView7 = new UIView (CoreGraphics.CGRect.FromLTRB (0, 0, 50, SECTION_SPACER));
            spaceView7.AddConstraint (NSLayoutConstraint.Create (spaceView7, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1, SECTION_SPACER));
            stackView.AddArrangedSubview (spaceView7);
        }
        private void CreateLayout()
        {
            nfloat height = 80;

            //set up UIStackView for laying out controls
            var stackView = new UIStackView(new CoreGraphics.CGRect(0, 0, View.Bounds.Width, View.Bounds.Height));
            stackView.Axis = UILayoutConstraintAxis.Vertical;
            stackView.Alignment = UIStackViewAlignment.Fill;
            stackView.Distribution = UIStackViewDistribution.FillProportionally;
            stackView.BackgroundColor = UIColor.Gray;

            // Setup the visual frame for the MapView
            _myMapView = new MapView()
            {
                Frame = new CoreGraphics.CGRect(0, 0, View.Bounds.Width, View.Bounds.Height-80)
            };

            stackView.AddArrangedSubview(_myMapView);

            // Create a tableview for displaying layer view status for each layer
            _tableView = new UITableView(new CoreGraphics.CGRect(0, _myMapView.Frame.Height, View.Bounds.Width, height));
            stackView.AddArrangedSubview(_tableView);

            // Add MapView to the page
            View.AddSubviews(stackView);
        }