示例#1
0
        private void SetupConstraints()
        {
            ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            ContentView.AddConstraints(
                _backPanelView.AtTopOf(ContentView, 20).WithIdentifier("BackPanelViewAtTopOf"),
                _backPanelView.AtLeftOf(ContentView, 20).WithIdentifier("BackPanelViewAtLeftOf"),
                _backPanelView.AtRightOf(ContentView, 20).WithIdentifier("BackPanelViewAtRightOf"),
                _backPanelView.AtBottomOf(ContentView, 20).WithIdentifier("BackPanelViewAtBottomOf"),

                _logo.AtTopOf(_backPanelView, 20).WithIdentifier("LogoAtTopOfBackPanel"),
                _logo.AtLeftOf(_backPanelView, 20).WithIdentifier("LogoAtLeftOrBackPanel"),
                _logo.Height().EqualTo().WidthOf(_logo).WithIdentifier("LogoHeightEqualToWidthLogo"),
                _logo.Width().EqualTo(80).WithIdentifier("LogoWdthEqualTo"),

                _name.ToRightOf(_logo, 20).WithIdentifier("NameToRightOfLogo"),
                _name.WithSameTop(_logo).Plus(2).WithIdentifier("NameWithSameTopLogo"),
                _name.AtRightOf(_backPanelView, 20).WithIdentifier("NameAtRightOfBackPanel"),

                _industry.Below(_name).WithIdentifier("IndustryBelowName"),
                _industry.WithSameLeft(_name).WithIdentifier("IndustryWithSameLeftName"),
                _industry.WithSameRight(_name).WithIdentifier("IndustrySameRightName"),
                _industry.Height().EqualTo(25).WithIdentifier("IndustryHeightEqualTo"),

                _horizontalLine.Below(_logo, 20).WithIdentifier("HorizontalLineBelowLogo"),
                _horizontalLine.Height().EqualTo(1).WithIdentifier("HorzontalLineHeightEqualTo"),
                _horizontalLine.WithSameLeft(_logo).WithIdentifier("HorizontalLineWithSameLeftLogo"),
                _horizontalLine.WithSameRight(_name).WithIdentifier("HorizontalLineSameRightName"),

                _numberOfCoworkers.Below(_horizontalLine, 5).WithIdentifier("NumberCoworkersBelowHorizontalLine"),
                _numberOfCoworkers.WithSameLeft(_horizontalLine).WithIdentifier("NumberCoworkersSameLeftHorizontalLine"),

                _usersCollection.Below(_horizontalLine, 5).WithIdentifier("UserCollBelowHorizontalLine"),
                _usersCollection.WithSameLeft(_logo).WithIdentifier("UserCollSameLeftLogo"),
                _usersCollection.WithSameRight(_industry).WithIdentifier("UserCollSameRightIndustry"),
                _usersCollection.AtBottomOf(_backPanelView, 5).WithIdentifier("UserCollBottomBackPanel"),
                _usersCollection.Height().EqualTo(30).WithIdentifier("UserCollHeightEqualTo")
                );
        }
示例#2
0
        private void SetupConstraints()
        {
            ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            _imageBackgroundTopSpacingConstraint =
                _imageBackground.Below(_infoBackGround, 5).ToLayoutConstraints().First();
            _imageBackgroundHeightConstraint = _imageBackground.Height().EqualTo(134).ToLayoutConstraints().First();

            _attendingHeight = _ruler.Below(_header, 125).ToLayoutConstraints().First();

            ContentView.AddConstraint(_imageBackgroundHeightConstraint);
            ContentView.AddConstraint(_imageBackgroundTopSpacingConstraint);
            ContentView.AddConstraint(_attendingHeight);

            ContentView.AddConstraints(
                _header.AtTopOf(ContentView),
                _header.AtLeftOf(ContentView),
                _header.AtRightOf(ContentView),
                _header.Height().EqualTo(345),

                _dateBackPanel.AtTopOf(ContentView, 20),
                _dateBackPanel.AtRightOf(ContentView, 20),
                _dateBackPanel.Width().EqualTo(90),
                _dateBackPanel.Height().EqualTo(25),

                _date.WithSameCenterY(_dateBackPanel),
                _date.WithSameCenterX(_dateBackPanel),

                _infoContainerPlaceHolder.Below(_dateBackPanel),
                _infoContainerPlaceHolder.Above(_attendButton),
                _infoContainerPlaceHolder.AtLeftOf(_header),
                _infoContainerPlaceHolder.AtRightOf(_header),

                _infoContainer.AtLeftOf(_header),
                _infoContainer.AtRightOf(_header),
                _infoContainer.WithSameCenterY(_infoContainerPlaceHolder),

                _title.AtTopOf(_infoContainer),
                _title.AtRightOf(_infoContainer, 20),
                _title.AtLeftOf(_infoContainer, 20),

                _time.Below(_title, 5),
                _time.AtLeftOf(_infoContainer, 20),
                _time.AtRightOf(_infoContainer, 20),

                _location.Below(_time, 5),
                _location.AtLeftOf(_infoContainer, 20),
                _location.AtRightOf(_infoContainer, 20),
                _location.Below(_infoContainer),

                _attendButton.Height().EqualTo(45),
                _attendButton.AtBottomOf(_header, 39),
                _attendButton.AtLeftOf(_header, 39),
                _attendButton.AtRightOf(_header, 39),

                _infoBackGround.Below(_header),
                _infoBackGround.AtLeftOf(ContentView),
                _infoBackGround.AtRightOf(ContentView),

                _attendingLabel.Below(_header, 30),
                _attendingLabel.AtLeftOf(ContentView, 14),
                _attendingLabel.AtRightOf(ContentView, 14),

                _attendingCollection.Below(_attendingLabel, 13),
                _attendingCollection.AtLeftOf(ContentView, 14),
                _attendingCollection.AtRightOf(ContentView, 14),
                _attendingCollection.Height().EqualTo(31),

                _ruler.AtLeftOf(ContentView, 10),
                _ruler.AtRightOf(ContentView, 10),
                _ruler.Height().EqualTo(1),

                _eventInfoHeader.Below(_ruler, 13),
                _eventInfoHeader.AtLeftOf(ContentView, 14),
                _eventInfoHeader.Height().EqualTo(20),

                _eventDateLabel.Below(_eventInfoHeader, 14),
                _eventDateLabel.AtLeftOf(ContentView, 14),
                _eventDateLabel.Height().EqualTo(20),

                _eventDate.AtLeftOf(ContentView, 100),
                _eventDate.WithSameCenterY(_eventDateLabel),

                _eventTimeLabel.Below(_eventDateLabel, 7),
                _eventTimeLabel.AtLeftOf(ContentView, 14),

                _eventTime.WithSameCenterY(_eventTimeLabel),
                _eventTime.WithSameLeft(_eventDate),
                _eventTime.AtRightOf(ContentView, 14),

                _eventLocationLabel.Below(_eventTimeLabel, 7),
                _eventLocationLabel.AtLeftOf(ContentView, 14),

                EventLocation.WithSameTop(_eventLocationLabel),
                EventLocation.WithSameLeft(_eventDate),
                EventLocation.AtRightOf(ContentView, 14),

                _infoBottomBorder.Below(EventLocation, 30),
                _infoBottomBorder.Height().EqualTo(1),
                _infoBottomBorder.AtLeftOf(ContentView),
                _infoBottomBorder.AtRightOf(ContentView),
                _infoBottomBorder.AtBottomOf(_infoBackGround),

                _imageBackground.AtLeftOf(ContentView),
                _imageBackground.AtRightOf(ContentView),

                _imageTopBorder.AtTopOf(_imageBackground),
                _imageTopBorder.AtLeftOf(ContentView),
                _imageTopBorder.AtRightOf(ContentView),
                _imageTopBorder.Height().EqualTo(1),

                _imageBottomBorder.AtBottomOf(_imageBackground),
                _imageBottomBorder.AtLeftOf(ContentView),
                _imageBottomBorder.AtRightOf(ContentView),
                _imageBottomBorder.Height().EqualTo(1),

                _imageCollection.AtTopOf(_imageBackground),
                _imageCollection.AtLeftOf(_imageBackground, 14),
                _imageCollection.AtRightOf(_imageBackground, 14),
                _imageCollection.AtBottomOf(_imageBackground),

                _aboutBackground.Below(_imageBackground, 5),
                _aboutBackground.AtLeftOf(ContentView),
                _aboutBackground.AtRightOf(ContentView),

                _aboutHeaderLabel.AtTopOf(_aboutBackground, 14),
                _aboutHeaderLabel.AtLeftOf(_aboutBackground, 14),
                _aboutHeaderLabel.AtRightOf(_aboutBackground, 14),
                _aboutHeaderLabel.Height().EqualTo(20),

                AboutText.Below(_aboutHeaderLabel, 13),
                AboutText.AtLeftOf(_aboutBackground, 12),
                AboutText.AtRightOf(_aboutBackground, 12),

                _aboutTopBorder.AtTopOf(_aboutBackground),
                _aboutTopBorder.Height().EqualTo(1),
                _aboutTopBorder.AtLeftOf(_aboutBackground),
                _aboutTopBorder.AtRightOf(_aboutBackground),

                _aboutRuler.Below(AboutText, 10),
                _aboutRuler.AtLeftOf(_aboutBackground),
                _aboutRuler.AtRightOf(_aboutBackground),
                _aboutRuler.Height().EqualTo(1),
                _aboutRuler.AtBottomOf(_aboutBackground)

                //_commentButton.Below(_aboutRuler),
                //_commentButton.AtLeftOf(ContentView, 14),
                //_commentButton.Height().EqualTo(50),
                );
        }
        public override void ViewDidLoad()
        {
            var addButton = new UIBarButtonItem(UIBarButtonSystemItem.Done, SaveChanges)
            {
                AccessibilityLabel = ConstantsHelper.ConfirmButtonAccessibilityLabel
            };

            View.BackgroundColor = UIColor.White;
            Title = NSBundle.MainBundle.GetLocalizedString(ConstantsHelper.NewNote, ConstantsHelper.NewNote);
            NavigationItem.RightBarButtonItem = addButton;

            _noteDescriptionHintLabel = new UILabel
            {
                Text          = ConstantsHelper.Note,
                TextAlignment = UITextAlignment.Left,
                TextColor     = UIColor.DarkGray,
                Font          = UIFont.SystemFontOfSize(14),
                TranslatesAutoresizingMaskIntoConstraints = false
            };
            View.AddSubview(_noteDescriptionHintLabel);
            View.AddConstraints(_noteDescriptionHintLabel.AtLeftOf(View, 10f),
                                _noteDescriptionHintLabel.AtTopOf(View, 80f),
                                _noteDescriptionHintLabel.Width().EqualTo(100f),
                                _noteDescriptionHintLabel.Height().EqualTo(20f));

            _noteDescriptionTextView = new UITextView
            {
                Text = ConstantsHelper.NewNote,
                Font = UIFont.SystemFontOfSize(16),
                TranslatesAutoresizingMaskIntoConstraints = false
            };

            View.AddSubview(_noteDescriptionTextView);
            View.AddConstraints(
                _noteDescriptionTextView.WithSameLeft(_noteDescriptionHintLabel),
                _noteDescriptionTextView.Below(_noteDescriptionHintLabel, 10f),
                _noteDescriptionTextView.WithSameWidth(View),
                _noteDescriptionTextView.Height().EqualTo(200));

            ConfigureView();

            _galleryHintLabel = new UILabel
            {
                Text          = ConstantsHelper.Gallery,
                TextAlignment = UITextAlignment.Left,
                TextColor     = UIColor.DarkGray,
                Font          = UIFont.SystemFontOfSize(14),
                TranslatesAutoresizingMaskIntoConstraints = false
            };
            View.AddSubview(_galleryHintLabel);
            View.AddConstraints(_galleryHintLabel.AtLeftOf(View, 10f),
                                _galleryHintLabel.Below(_noteDescriptionTextView, 10f),
                                _galleryHintLabel.Width().EqualTo(100f),
                                _galleryHintLabel.Height().EqualTo(20f));

            var collectionView = new UICollectionView(CGRect.Empty, new GalleryCollectionViewLayout())
            {
                TranslatesAutoresizingMaskIntoConstraints = false
            };

            View.AddSubview(collectionView);

            collectionView.BackgroundColor      = UIColor.White;
            collectionView.AlwaysBounceVertical = true;
            collectionView.Bounces = true;
            collectionView.RegisterClassForCell(typeof(GalleryViewCell), nameof(GalleryViewCell));
            var galleryItems = new List <GalleryItemModel>
            {
                new GalleryItemModel
                {
                    ImagePath =
                        "https://ak5.picdn.net/shutterstock/videos/3775625/thumb/1.jpg?i10c=img.resize(height:160)"
                },
                new GalleryItemModel
                {
                    ImagePath =
                        "https://ak5.picdn.net/shutterstock/videos/3775625/thumb/1.jpg?i10c=img.resize(height:160)"
                },
                new GalleryItemModel
                {
                    ImagePath =
                        "https://ak5.picdn.net/shutterstock/videos/3775625/thumb/1.jpg?i10c=img.resize(height:160)"
                },
                new GalleryItemModel
                {
                    ImagePath =
                        "https://ak5.picdn.net/shutterstock/videos/3775625/thumb/1.jpg?i10c=img.resize(height:160)"
                },
                new GalleryItemModel
                {
                    ImagePath =
                        "https://ak5.picdn.net/shutterstock/videos/3775625/thumb/1.jpg?i10c=img.resize(height:160)"
                },
                new GalleryItemModel
                {
                    ImagePath =
                        "https://ak5.picdn.net/shutterstock/videos/3775625/thumb/1.jpg?i10c=img.resize(height:160)"
                },
                new GalleryItemModel
                {
                    ImagePath =
                        "https://ak5.picdn.net/shutterstock/videos/3775625/thumb/1.jpg?i10c=img.resize(height:160)"
                },
                new GalleryItemModel
                {
                    ImagePath =
                        "https://ak5.picdn.net/shutterstock/videos/3775625/thumb/1.jpg?i10c=img.resize(height:160)"
                },
                new GalleryItemModel
                {
                    ImagePath =
                        "https://ak5.picdn.net/shutterstock/videos/3775625/thumb/1.jpg?i10c=img.resize(height:160)"
                },
                new GalleryItemModel
                {
                    ImagePath =
                        "https://ak5.picdn.net/shutterstock/videos/3775625/thumb/1.jpg?i10c=img.resize(height:160)"
                }
            };

            collectionView.Source   = new GalleryCollectionViewSource(galleryItems, this);
            collectionView.Delegate = new GalleryCollectionViewDelegate(galleryItems, this, new UIEdgeInsets(5, 5, 5, 5));
            collectionView.ReloadData();

            View.AddConstraints(collectionView.Below(_galleryHintLabel, 30f),
                                collectionView.WithSameWidth(View),
                                collectionView.Below(_galleryHintLabel, 5f),
                                collectionView.AtBottomOf(View, 70f));

            var bottomBar = new UIView
            {
                BackgroundColor = UIColor.FromRGB(50, 50, 50),
                TranslatesAutoresizingMaskIntoConstraints = false,
            };

            _pickImage = new UIImageView(UIImage.FromBundle(ConstantsHelper.AddIcon))
            {
                ContentMode = UIViewContentMode.Center,
                TranslatesAutoresizingMaskIntoConstraints = false
            };
            _cameraImage = new UIImageView(UIImage.FromBundle(ConstantsHelper.CameraIcon))
            {
                ContentMode = UIViewContentMode.Center,
                TranslatesAutoresizingMaskIntoConstraints = false
            };
            _videoImage = new UIImageView(UIImage.FromBundle(ConstantsHelper.VideoIcon))
            {
                ContentMode = UIViewContentMode.Center,
                TranslatesAutoresizingMaskIntoConstraints = false
            };

            bottomBar.AddSubviews(_pickImage, _cameraImage, _videoImage);
            bottomBar.AddConstraints(_pickImage.Height().EqualTo(70f),
                                     _pickImage.AtLeftOf(bottomBar),
                                     _pickImage.Width().EqualTo(70f),
                                     _pickImage.WithSameCenterY(bottomBar),
                                     _cameraImage.ToRightOf(_pickImage),
                                     _cameraImage.Height().EqualTo(70f),
                                     _cameraImage.Width().EqualTo(70f),
                                     _cameraImage.WithSameCenterY(bottomBar),
                                     _videoImage.ToRightOf(_cameraImage),
                                     _videoImage.Height().EqualTo(70f),
                                     _videoImage.Width().EqualTo(70f),
                                     _videoImage.WithSameCenterY(bottomBar));

            View.AddSubview(bottomBar);
            View.AddConstraints(bottomBar.WithSameWidth(View),
                                bottomBar.Height().EqualTo(70f),
                                bottomBar.AtBottomOf(View));
        }