private void SetupConstraints() { ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); _bottomRulerLeftConstraint = _bottomRuler.AtLeftOf(ContentView, 14).ToLayoutConstraints().First(); _bottomRulerRightConstraint = _bottomRuler.AtRightOf(ContentView, 14).ToLayoutConstraints().First(); ContentView.AddConstraint(_bottomRulerLeftConstraint); ContentView.AddConstraint(_bottomRulerRightConstraint); ContentView.AddConstraints( _avatar.AtTopOf(ContentView, 14), _avatar.AtLeftOf(ContentView, 14), _avatar.Height().EqualTo(35), _avatar.Width().EqualTo(35), _displayName.WithSameTop(_avatar).Minus(2), _displayName.Height().EqualTo(20), _displayName.ToRightOf(_avatar, 13), _timeAgo.ToRightOf(_displayName, 7), _timeAgo.WithSameBottom(_displayName), //_timeAgo.AtLeftOf(ContentView, 14), Text.Below(_displayName, 3), Text.ToLeftOf(_contextButton, 10), Text.ToRightOf(_avatar, 10), _contextButton.AtRightOf(ContentView, 10), _contextButton.AtTopOf(ContentView, 5), _contextButton.Width().EqualTo(30), _contextButton.Height().EqualTo(30), _bottomRuler.Height().EqualTo(1), _bottomRuler.AtBottomOf(ContentView) ); }
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), ); }
private void SetupConstraints() { ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); // Backpanel bottom constraint for usage in detailsview _backPanelBottomConstraint = _backPanel.AtBottomOf(ContentView, 0).WithIdentifier("BackPanelBottomToView").ToLayoutConstraints().First(); // Main image constraints _mainImageHeightConstraint = _mainImage.Height().EqualTo(0).WithIdentifier("MainImageHeightConstraint").ToLayoutConstraints().First(); _mainImageBottomSpacingConstraint = _mainImage.Above(_leftSubImage, 3).WithIdentifier("MainImageAboveLeftSub").ToLayoutConstraints().First(); // Sub image constraints _subImageSpacingConstraint = _leftSubImage.Above(_ruler, 8).WithIdentifier("LeftSubImageAboveRuler").ToLayoutConstraints().First(); _subImageHeightConstraint = _leftSubImage.Height().EqualTo(50).WithIdentifier("LeftSubHeight").ToLayoutConstraints().First(); ContentView.AddConstraint(_backPanelBottomConstraint); ContentView.AddConstraint(_mainImageHeightConstraint); ContentView.AddConstraint(_mainImageBottomSpacingConstraint); ContentView.AddConstraint(_subImageSpacingConstraint); ContentView.AddConstraint(_subImageHeightConstraint); ContentView.AddConstraints( // TOP _backPanel.AtTopOf(ContentView, 5).WithIdentifier("BackPanelAtTopContentView"), _backPanel.AtRightOf(ContentView, 0).WithIdentifier("BackPanelAtRightOfContentView"), _backPanel.AtLeftOf(ContentView, 0).WithIdentifier("BackPanelAtLeftOfContentView"), _topBorder.AtTopOf(_backPanel).WithIdentifier("TopBorderAtTopOfBackpanel"), _topBorder.AtLeftOf(_backPanel).WithIdentifier("TopBorderAtLeftOfBackpanel"), _topBorder.AtRightOf(_backPanel).WithIdentifier("TopBorderAtRightOfBackpanel"), _topBorder.Height().EqualTo(1).WithIdentifier("TopBorderHeightEqualTo1"), _avatarImageView.Below(_topBorder, 14).WithIdentifier("AvatarImageBelowTopBorder"), _avatarImageView.AtLeftOf(_backPanel, 14).WithIdentifier("AvatarImageAtLeftOfBackPanel"), _avatarImageView.Height().EqualTo(45).WithIdentifier("AvatarImageHeightEquealTo"), _avatarImageView.Width().EqualTo(45).WithIdentifier("AvatarImageWidthEqualTo"), _displayName.Bottom().EqualTo().CenterYOf(_avatarImageView).Minus(1.5f).WithIdentifier("DisplayNameBottomEqualtoCenterYOfAvatarImage"), _displayName.ToRightOf(_avatarImageView, 10).WithIdentifier("DisplayNameToRightOfAvatarImage"), _displayName.ToLeftOf(_contextButton, 13), _timeAgo.Below(_displayName, 3).WithIdentifier("TimeAgoBelowDisplayName"), _timeAgo.WithSameLeft(_displayName).WithIdentifier("TimeAgoWithSameLeftDisplayName"), _timeAgo.WithSameRight(_displayName).WithIdentifier("TimeAgoWithSameRightDisplayName"), _postText.Below(_avatarImageView, 8).WithIdentifier("PostTextBelowAvatarImage"), _postText.AtLeftOf(_backPanel, 11).WithIdentifier("PostTextAtLeftOfBackPanel"), _postText.AtRightOf(_backPanel, 14).WithIdentifier("PostTextAtRightOfBackPanel"), _contextButton.AtRightOf(_backPanel, 10), _contextButton.AtTopOf(_backPanel, 5), _contextButton.Width().EqualTo(30), _contextButton.Height().EqualTo(30), // CONTENT _mainImage.AtLeftOf(_backPanel).WithIdentifier("MainImageAtLeftOfBackPanel"), _mainImage.AtRightOf(_backPanel).WithIdentifier("MainImageAtRightOfBackPanel"), // INFORMATION _dateBackPanel.AtTopOf(_mainImage, 20).WithIdentifier("DateBackPanelAtTopOfContentView"), _dateBackPanel.AtRightOf(_mainImage, 20).WithIdentifier("DateBackPanelAtRightOfContentView"), _dateBackPanel.Width().EqualTo(90).WithIdentifier("DateBackPanelWidth"), _dateBackPanel.Height().EqualTo(25).WithIdentifier("DateBackPanelHeight"), _date.WithSameCenterY(_dateBackPanel).WithIdentifier("DateAtRightOfContentView"), _date.WithSameCenterX(_dateBackPanel).WithIdentifier("DateAtBottomOfContentView"), _infoContainerPlaceholder.AtTopOf(_mainImage), _infoContainerPlaceholder.AtLeftOf(_mainImage), _infoContainerPlaceholder.AtRightOf(_mainImage), _infoContainerPlaceholder.AtBottomOf(_mainImage), _infoContainer.AtLeftOf(_infoContainerPlaceholder).WithIdentifier("InfoContainerAtLeftOfBackground"), _infoContainer.AtRightOf(_infoContainerPlaceholder).WithIdentifier("InforContainerAtRightOfBackground"), _infoContainer.WithSameCenterY(_infoContainerPlaceholder), _title.AtLeftOf(_infoContainer, 20).WithIdentifier("NameAtLeftOfBackgorund"), _title.AtRightOf(_infoContainer, 20).WithIdentifier("NameAtRightBackground"), _title.AtTopOf(_infoContainer, 4), _time.Below(_title, 5).WithIdentifier("TimeAboveLocation"), _time.AtLeftOf(_infoContainer, 20).WithIdentifier("TimeAtLeftOfBackground"), _time.AtRightOf(_infoContainer, 20).WithIdentifier("TimeAtRightOfBackground"), _location.Below(_time, 3), _location.AtBottomOf(_infoContainer), _location.AtLeftOf(_infoContainer, 20), _location.AtRightOf(_infoContainer, 20), // --------------------------------------------- _leftSubImage.AtLeftOf(_backPanel).WithIdentifier("LeftSubImageAtLeftOfBackPanel"), _rightSubImage.WithSameTop(_leftSubImage).WithIdentifier("RightSubImageWithSameTopLeftSub"), _rightSubImage.WithSameWidth(_leftSubImage).WithIdentifier("RightSubImageWithSameWidthLeftSub"), _rightSubImage.AtRightOf(_backPanel).WithIdentifier("RightSubImageAtRightOfBackPanel"), _rightSubImage.ToRightOf(_leftSubImage, 3).WithIdentifier("RightSubImageToRightOfLeftSub"), _rightSubImage.WithSameHeight(_leftSubImage).WithIdentifier("RightSubImageWithSameHeightLeftSub"), // BOTTOM _ruler.Above(_commentButton).WithIdentifier("RulerBelowContentContainer"), _ruler.Height().EqualTo(1).WithIdentifier("RulerHeightEqualTo1"), _ruler.WithSameLeft(_avatarImageView).WithIdentifier("RulerWithSameLeftAvatarImage"), _ruler.WithSameRight(_displayName).WithIdentifier("RulerWithSameRightDisplayName"), _commentButton.Above(_bottomBorder).WithIdentifier("CommentButtonBelowRuler"), _commentButton.WithSameLeft(_avatarImageView).WithIdentifier("CommentWithSameLeftAvatarImage"), _commentButton.Height().EqualTo(50).WithIdentifier("CommentButtonHeightEqualTo"), _likeButton.WithSameCenterY(_commentButton).WithIdentifier("LikeButtonWithSameCenterYCommentButton"), _likeButton.ToRightOf(_commentButton, 15).WithIdentifier("LikeButtonToRightOfCommentButton"), _likeButton.WithSameHeight(_commentButton).WithIdentifier("LikeButtonWithSameHeightCommentButton"), _bottomBorder.AtBottomOf(_backPanel).WithIdentifier("BottomBorderAtBottomOfBackPanel"), _bottomBorder.AtLeftOf(_backPanel).WithIdentifier("BottomBorderAtLeftOfBackPanel"), _bottomBorder.AtRightOf(_backPanel).WithIdentifier("BottomBorderAtRightOfBackPanel"), _bottomBorder.Height().EqualTo(1).WithIdentifier("BottomBorderHeightEqualTo1") ); }