Open benhysell opened 11 years ago
Also tried on real hardware, iPad version 3 with iOS 6.1...same issue as simulator. Cross-posted on StackOverflow, http://stackoverflow.com/questions/17794440/flyoutnavigation-views-using-nslayoutconstraints-fail-to-properly-draw-view-on.
I have an odd behavior I'm trying to track down, and I'm not sure if it is FlyoutNavigation or something else I'm doing. Maybe someone can take a quick look who understands things a bit better than I do.
Example Project - https://github.com/benhysell/FlyoutNavigationWithNSLayoutConstraintsError
Goal - Use https://gist.github.com/praeclarum/5175100, A C# syntax for NSLayoutConstraints, described in this blog post, http://praeclarum.org/post/45690317491/easy-layout-a-dsl-for-nslayoutconstraint, with FlyoutNavigation.
Issue - On the first use of a view that incorporates NSLayoutConstraints the view doesn't respect the constraints or background color, both odd. On subsequent 'selections' of the view from the menu of FlyoutNavigation the view will properly draw.
Setup - Working in Xamarin Beta Channel against iPhone Simulator 6.1 and the latest released Xcode.
Steps to Reproduce
Add a new UIViewController and the following to ViewDidLoad(), note this was modified from the Xamarin 'Hello World' sample app one can create in VS2012
public override void ViewDidLoad() { base.ViewDidLoad();
navigation.ViewControllers = Array.ConvertAll (Tasks, title => new UINavigationController (new TaskPageController (navigation, title)) );
with
navigation.ViewControllers = Array.ConvertAll(Tasks, title => new UINavigationController(new MyViewController(navigation)) );
I'm saying 'make every view a view that implements NSLayoutConstraints'.
this.View.AddSubview (mainView);
ViewControllers[0].ChildViewControllers[0].View.Frame {{X=160,Y=208,Width=0,Height=0}} System.Drawing.RectangleF
This is the incorrect size for the view, however after I step over line 238:
ViewControllers[0].ChildViewControllers[0].View.Frame {{X=0,Y=0,Width=320,Height=416}} System.Drawing.RectangleF
The position is fixed, and the view will draw correctly.
Summary I've tried using the gist with the NSLayoutConstraints by itself in a single page window application without issue, and I'm thinking since it does eventually draw properly after a second invokation of FlyoutNavigation I'm thinking there is a 'something' I'm missing with the FlyoutNavigation, or setting incorrectly that I can't put my finger on.