I want to programmatically constrain the width and height of a view
using the autolayout feature of iOS 6 and MT 6. The static
NSLayoutConstraint.Create method requires two views, but "pinning"
width/height is a constraint over only 1 view. The iOS doc for the
corresponding Objective-C method states "If the constraint you wish to
express does not have a second view and attribute, use nil and
NSLayoutAttributeNotAnAttribute [in place of the second view and
attribute]." But if I use the corresponding C# values (null and
NSLayoutAttribute.NoAttribute) in NSLayoutConstraint.Create as follows

  var x = NSLayoutConstraint.Create(myView, NSLayoutAttribute.Height,
NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 0f, 30f);

MT throws an exception. Specifically, using null as the value of view2
raises ArgumentNullException, and using NSLayoutAttribute.NoAttribute
as the value of attribute2 raises a MonoTouchException wrapping native
NSInvalidArgumentException with the message "Unknown layout
attribute".

Am I doing something wrong, or is this a bug?

Thanks,
Len
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to