private void SetupConstraints() { ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); ContentView.AddConstraints( _backPanel.AtTopOf(ContentView, 5), _backPanel.AtBottomOf(ContentView, 5), _backPanel.AtRightOf(ContentView, 0), _backPanel.AtLeftOf(ContentView, 0), _backPanel.Height().GreaterThanOrEqualTo(40), _topBorder.AtTopOf(_backPanel), _topBorder.AtLeftOf(_backPanel), _topBorder.AtRightOf(_backPanel), _topBorder.Height().EqualTo(1), _bottomBorder.AtBottomOf(_backPanel), _bottomBorder.AtLeftOf(_backPanel), _bottomBorder.AtRightOf(_backPanel), _bottomBorder.Height().EqualTo(1), _avatarImage.Below(_topBorder, 14), _avatarImage.AtLeftOf(_backPanel, 14), _avatarImage.Height().EqualTo(45), _avatarImage.Width().EqualTo(45), _displayName.WithSameCenterY(_avatarImage).Plus(-13), _displayName.ToRightOf(_avatarImage, 10), _displayName.AtRightOf(_backPanel, 13), _timeAgo.Below(_displayName, 3), _timeAgo.WithSameLeft(_displayName), _timeAgo.WithSameRight(_displayName), _contentContainer.Below(_avatarImage, 10), _contentContainer.WithSameLeft(_avatarImage), _contentContainer.WithSameRight(_displayName), _contentContainer.Height().GreaterThanOrEqualTo(30), _ruler.Below(_contentContainer, 15), _ruler.Height().EqualTo(1), _ruler.WithSameLeft(_avatarImage), _ruler.WithSameRight(_displayName), _commentButton.Below(_ruler), _commentButton.WithSameLeft(_avatarImage), _commentButton.Above(_bottomBorder), _commentButton.Height().EqualTo(50), _likeButton.WithSameCenterY(_commentButton), _likeButton.ToRightOf(_commentButton, 15), _likeButton.WithSameHeight(_commentButton) ); // This call does not set the property on the child views of child views so we call this on the content container as well _contentContainer.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); _contentContainer.AddConstraints(AddContentConstraints(_contentContainer)); }
public override void LoadView() { View = new UIImageView() { UserInteractionEnabled = true, }.Apply(Style.Welcome.Background); View.Add(logoImageView = new UIImageView().Apply(Style.Welcome.Logo)); View.Add(sloganLabel = new UILabel() { Text = "WelcomeSlogan".Tr(), }.Apply(Style.Welcome.Slogan)); View.Add(createButton = new UIButton().Apply(Style.Welcome.CreateAccount)); View.Add(passwordButton = new UIButton().Apply(Style.Welcome.PasswordLogin)); View.Add(googleButton = new UIButton().Apply(Style.Welcome.GoogleLogin)); createButton.SetTitle("WelcomeCreate".Tr(), UIControlState.Normal); passwordButton.SetTitle("WelcomePassword".Tr(), UIControlState.Normal); googleButton.SetTitle("WelcomeGoogle".Tr(), UIControlState.Normal); createButton.TouchUpInside += OnCreateButtonTouchUpInside; passwordButton.TouchUpInside += OnPasswordButtonTouchUpInside; googleButton.TouchUpInside += OnGoogleButtonTouchUpInside; View.AddConstraints( logoImageView.AtTopOf(View, 70f), logoImageView.WithSameCenterX(View), sloganLabel.Below(logoImageView, 18f), sloganLabel.AtLeftOf(View, 25f), sloganLabel.AtRightOf(View, 25f), googleButton.AtBottomOf(View, 20f), googleButton.AtLeftOf(View), googleButton.AtRightOf(View), googleButton.Height().EqualTo(60f), passwordButton.Above(googleButton, 25f), passwordButton.AtLeftOf(View), passwordButton.AtRightOf(View), passwordButton.Height().EqualTo(60f), createButton.Above(passwordButton, 5f), createButton.AtLeftOf(View), createButton.AtRightOf(View), createButton.Height().EqualTo(60f) ); View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); }
public override void LoadView () { View = new UIImageView () { UserInteractionEnabled = true, } .Apply (Style.Welcome.Background); View.Add (logoImageView = new UIImageView ().Apply (Style.Welcome.Logo)); View.Add (sloganLabel = new UILabel () { Text = "WelcomeSlogan".Tr (), } .Apply (Style.Welcome.Slogan)); View.Add (createButton = new UIButton ().Apply (Style.Welcome.CreateAccount)); View.Add (passwordButton = new UIButton ().Apply (Style.Welcome.PasswordLogin)); View.Add (googleButton = new UIButton ().Apply (Style.Welcome.GoogleLogin)); createButton.SetTitle ("WelcomeCreate".Tr (), UIControlState.Normal); passwordButton.SetTitle ("WelcomePassword".Tr (), UIControlState.Normal); googleButton.SetTitle ("WelcomeGoogle".Tr (), UIControlState.Normal); createButton.TouchUpInside += OnCreateButtonTouchUpInside; passwordButton.TouchUpInside += OnPasswordButtonTouchUpInside; googleButton.TouchUpInside += OnGoogleButtonTouchUpInside; View.AddConstraints ( logoImageView.AtTopOf (View, 70f), logoImageView.WithSameCenterX (View), sloganLabel.Below (logoImageView, 18f), sloganLabel.AtLeftOf (View, 25f), sloganLabel.AtRightOf (View, 25f), googleButton.AtBottomOf (View, 20f), googleButton.AtLeftOf (View), googleButton.AtRightOf (View), googleButton.Height ().EqualTo (60f), passwordButton.Above (googleButton, 25f), passwordButton.AtLeftOf (View), passwordButton.AtRightOf (View), passwordButton.Height ().EqualTo (60f), createButton.Above (passwordButton, 5f), createButton.AtLeftOf (View), createButton.AtRightOf (View), createButton.Height ().EqualTo (60f) ); View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints (); }
private void SetupConstraints() { ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); ContentView.AddConstraints( ContentView.Height().EqualTo(300), _backPanelView.AtTopOf(ContentView, 20), _backPanelView.AtLeftOf(ContentView, 20), _backPanelView.AtRightOf(ContentView, 20), _backPanelView.AtBottomOf(ContentView, 20), _horizontalLine.WithSameCenterY(_backPanelView), _horizontalLine.AtLeftOf(_backPanelView, 10), _horizontalLine.AtRightOf(_backPanelView, 10), _horizontalLine.Height().EqualTo(1), _verticalLine.WithSameCenterX(_backPanelView), _verticalLine.AtTopOf(_backPanelView, 10), _verticalLine.AtBottomOf(_backPanelView, 10), _verticalLine.Width().EqualTo(1), _membersButton.AtTopOf(_backPanelView), _membersButton.AtLeftOf(_backPanelView), _membersButton.AtRightOf(_verticalLine), _membersButton.Above(_horizontalLine), _eventsButton.AtTopOf(_backPanelView), _eventsButton.AtRightOf(_backPanelView), _eventsButton.AtLeftOf(_verticalLine), _eventsButton.Above(_horizontalLine), _groupsButton.AtBottomOf(_backPanelView), _groupsButton.AtLeftOf(_backPanelView), _groupsButton.AtRightOf(_verticalLine), _groupsButton.Below(_horizontalLine), _infoButton.AtBottomOf(_backPanelView), _infoButton.AtRightOf(_backPanelView), _infoButton.AtLeftOf(_verticalLine), _infoButton.Below(_horizontalLine) ); }
public override void ViewDidLoad() { base.ViewDidLoad(); Title = "Chafu"; var deleteAll = new UIBarButtonItem(UIBarButtonSystemItem.Trash) { TintColor = Configuration.BackgroundColor }; NavigationController.NavigationBar.BarTintColor = Configuration.TintColor; NavigationController.NavigationBar.TintColor = Configuration.BaseTintColor; NavigationItem.RightBarButtonItem = deleteAll; View.BackgroundColor = Configuration.BackgroundColor; Configuration.CropImage = true; var imageView = new UIImageView { BackgroundColor = UIColor.Black }; var urlLabel = new UILabel(); var pickerButton = new UIButton(UIButtonType.System) { BackgroundColor = Configuration.TintColor, TintColor = UIColor.Black }; pickerButton.SetTitle("Pick Image", UIControlState.Normal); var albumButton = new UIButton(UIButtonType.System) { BackgroundColor = Configuration.TintColor, TintColor = UIColor.Black }; albumButton.SetTitle("Show Album", UIControlState.Normal); var chafu = new ChafuViewController { HasVideo = true }; chafu.ImageSelected += (sender, image) => { DispatchQueue.MainQueue.DispatchAsync(() => { imageView.Image = image; }); CopyImageToLocalFolder(image); }; chafu.VideoSelected += (sender, videoUrl) => { urlLabel.Text = videoUrl.AbsoluteString; CopyVideoToLocalFolder(videoUrl); }; chafu.Closed += (sender, e) => { /* do stuff on closed */ }; pickerButton.TouchUpInside += (sender, args) => { NavigationController.PresentModalViewController(chafu, true); }; var albumViewController = new AlbumViewController { LazyDataSource = (view, size, mediaTypes) => new LocalFilesDataSource(view, size, mediaTypes) { ImagesPath = TempPath() }, LazyDelegate = (view, source) => new LocalFilesDelegate(view, (LocalFilesDataSource)source), ShowExtraButton = true, ShowDoneButton = false, ShowDeleteButton = true }; albumViewController.Extra += (sender, args) => { albumViewController.Dismiss(); NavigationController.PresentModalViewController(chafu, true); }; albumViewController.ImageSelected += (sender, image) => { imageView.Image = image; }; albumButton.TouchUpInside += (sender, args) => { // Test InitialSelectedImage by selecting random path albumViewController.InitialSelectedImagePath = GetRandomPath(); NavigationController.PresentModalViewController(albumViewController, true); }; deleteAll.Clicked += (sender, args) => { DeleteAllStuff(); ((LocalFilesDataSource)albumViewController.AlbumDataSource)?.UpdateImageSource(TempPath()); }; Add(imageView); Add(urlLabel); Add(pickerButton); Add(albumButton); View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); EdgesForExtendedLayout = UIRectEdge.None; View.AddConstraints( imageView.Width().EqualTo().HeightOf(imageView), imageView.AtTopOf(View, 5), imageView.AtLeftOf(View, 5), imageView.AtRightOf(View, 5), imageView.Above(urlLabel, 10), urlLabel.AtLeftOf(View, 5), urlLabel.AtRightOf(View, 5), urlLabel.Above(pickerButton, 10), pickerButton.AtLeftOf(View, 50), pickerButton.AtRightOf(View, 50), pickerButton.Height().EqualTo(50), pickerButton.Above(albumButton, 20), albumButton.AtLeftOf(View, 50), albumButton.AtRightOf(View, 50), albumButton.Height().EqualTo(50), albumButton.AtBottomOf(View, 10f) ); }
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") ); }
private void SetupConstraints() { ScrollView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); _containerView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); View.AddConstraints( _containerView.WithSameWidth(View), _background.AtTopOf(View), _background.AtLeftOf(View), _background.AtRightOf(View), _background.AtBottomOf(View) ); ScrollView.AddConstraints( _containerView.AtTopOf(ScrollView), _containerView.AtLeftOf(ScrollView), _containerView.AtRightOf(ScrollView), _containerView.AtBottomOf(ScrollView), _containerView.Height().EqualTo(UIScreen.MainScreen.Bounds.Height) ); _containerView.AddConstraints( _logo.AtTopOf(_containerView, 40), _logo.WithSameCenterX(_containerView), _indicator.Below(_logo, 30), _indicator.WithSameCenterX(_logo), _registerButton.AtBottomOf(_containerView, 40), _registerButton.AtLeftOf(_containerView, 35), _forgotPasswordButton.AtBottomOf(_containerView, 40), _forgotPasswordButton.AtRightOf(_containerView, 35), _signinButton.Above(_registerButton, 40), _signinButton.Height().EqualTo(40), _signinButton.WithSameLeft(_registerButton), _signinButton.WithSameRight(_forgotPasswordButton), _passwordRuler.Above(_signinButton, 30), _passwordRuler.WithSameLeft(_registerButton), _passwordRuler.WithSameRight(_forgotPasswordButton), _passwordRuler.Height().EqualTo(1), _password.Above(_passwordRuler, 15), _password.WithSameRight(_forgotPasswordButton), _password.Height().EqualTo(20), _password.ToRightOf(_passwordImage, 15), _passwordImage.WithSameCenterY(_password), _passwordImage.WithSameLeft(_passwordRuler), _passwordImage.Height().EqualTo(20), _passwordImage.Width().EqualTo(20), _emailRuler.Above(_password, 15), _emailRuler.WithSameLeft(_registerButton), _emailRuler.WithSameRight(_forgotPasswordButton), _emailRuler.Height().EqualTo(1), _email.Above(_emailRuler, 15), _email.WithSameRight(_forgotPasswordButton), _email.Height().EqualTo(20), _email.ToRightOf(_emailImage, 15), _emailImage.WithSameCenterY(_email), _emailImage.WithSameLeft(_emailRuler), _emailImage.Height().EqualTo(20), _emailImage.Width().EqualTo(20) ); }