Skip to content

Instantly share code, notes, and snippets.

@lubiepomaranczki
Created May 6, 2020 06:45
Show Gist options
  • Save lubiepomaranczki/40889087a9063748b48fc1e4c891550d to your computer and use it in GitHub Desktop.
Save lubiepomaranczki/40889087a9063748b48fc1e4c891550d to your computer and use it in GitHub Desktop.
Solution to the problem described here https://twitter.com/lawiluk/status/1257661151258820608 Solution proposed
public class FormsTestView : BaseViewController<FormsTestViewModel>
{
public override void ViewDidLoad()
{
base.ViewDidLoad();
EdgesForExtendedLayout = UIRectEdge.None;
View.BackgroundColor = UIColor.Green;
Xamarin.Forms.Forms.Init();
var page = new FormsTestPage { BindingContext = ViewModel };
var formsViewController = page.CreateViewController();
formsViewController.View.TranslatesAutoresizingMaskIntoConstraints = false;
formsViewController.WillMoveToParentViewController(this);
formsViewController.ViewWillAppear(true);
View.Add(formsViewController.View);
formsViewController.View.LeftAnchor.ConstraintEqualTo(View.LeftAnchor).Active = true;
formsViewController.View.TopAnchor.ConstraintEqualTo(View.TopAnchor).Active = true;
formsViewController.View.RightAnchor.ConstraintEqualTo(View.RightAnchor).Active = true;
formsViewController.View.BottomAnchor.ConstraintEqualTo(View.BottomAnchor).Active = true;
formsViewController.ViewDidAppear(true);
formsViewController.DidMoveToParentViewController(this);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment