Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
UIStackViewPlayground/Views/AnchorPocViewController.cs
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
36 lines (29 sloc)
970 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UIKit; | |
using UIStackViewPlayground.Helpers; | |
namespace UIStackViewPlayground.Views | |
{ | |
public class AnchorPocViewController : BaseViewController | |
{ | |
private NSLayoutConstraint[] _small; | |
private NSLayoutConstraint[] _big; | |
private bool _isBig; | |
public override void ViewDidLoad() | |
{ | |
base.ViewDidLoad(); | |
var box = new RoundedView { BackgroundColor = UIColor.Blue }; | |
View.Add(box); | |
box.CenterIn(View); | |
_small = box.ConstraintSize(50, 50); | |
_big = box.ConstraintSize(150, 300, false); | |
box.AddGestureRecognizer(new UITapGestureRecognizer(ChangeState) { CancelsTouchesInView = false }); | |
} | |
private void ChangeState() | |
{ | |
if (_isBig) | |
View.ChangeState(_big, _small, 0.3); | |
else | |
View.ChangeState(_small, _big, 0.3); | |
_isBig = !_isBig; | |
} | |
} | |
} |