Esempio n. 1
0
        private void InitView()
        {
            var sheet = new StackView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                BackgroundColor  = BackColor,
                AutoresizingMask = UIViewAutoresizing.FlexibleWidth,
                Alignment        = UIStackViewAlignment.Fill,
                Distribution     = UIStackViewDistribution.Fill,
                Axis             = UILayoutConstraintAxis.Vertical
            };

            //float distanceX = 2;
            //float distanceY = 2;
            //sheet.Layer.ShadowColor = UIColor.Black.CGColor;
            //sheet.Layer.ShadowOffset = new CGSize(distanceX, distanceY);
            //sheet.Layer.ShadowOpacity = 1.0f;

            //sheet.AddArrangedSubview(CreateSeparator());
            foreach (var option in _config.Options)
            {
                var view = CreateActionItem(option);
                sheet.AddArrangedSubview(view);
                view.HeightAnchor.ConstraintEqualTo(RowHeight).Active = true;
                sheet.AddConstraint(NSLayoutConstraint.Create(sheet, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, view, NSLayoutAttribute.Leading, 1, 0));
                sheet.AddConstraint(NSLayoutConstraint.Create(sheet, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, view, NSLayoutAttribute.Trailing, 1, 0));

                sheet.AddArrangedSubview(CreateSeparator());
            }



            var cancel = CreateCancelView(_config.Cancel);

            sheet.AddArrangedSubview(cancel);
            sheet.AddConstraint(NSLayoutConstraint.Create(sheet, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, cancel, NSLayoutAttribute.Leading, 1, 0));
            sheet.AddConstraint(NSLayoutConstraint.Create(sheet, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, cancel, NSLayoutAttribute.Trailing, 1, 0));

            this.View.AddSubview(sheet);

            this.View.AddConstraint(NSLayoutConstraint.Create(this.View, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, sheet, NSLayoutAttribute.Bottom, 1, 0));
            this.View.AddConstraint(NSLayoutConstraint.Create(this.View, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, sheet, NSLayoutAttribute.Leading, 1, 0));
            this.View.AddConstraint(NSLayoutConstraint.Create(this.View, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, sheet, NSLayoutAttribute.Trailing, 1, 0));
        }