Using NSLayoutConstraint.Create*, what is the right way to pin the width of a view to a constant value? In this case, the constraint involves only one view. I would expect the following to work:
var b = UIButton.FromType(UIButtonType.RoundedRect); b.AddConstraint(NSLayoutConstraint.Create(b, NSLayoutAttribute.Width, NSLayoutRelation.Equal, b, NSLayoutAttribute.NoAttribute, 0f, 100f)); The use of variable b for parameter view2 in Create() is redundant, but seems harmless (since the multiplier is zero). However, the use of NSLayoutAttribute.NoAttribute fails at run-time, causing an NSInvalidArgumentException with reason "*** +[NSLayoutConstraint constraintWithItem:attribute:relatedBy:toItem:attribute:multiplier:constant:]: Unknown layout attribute". It looks like NSLayoutAttribute.NoAttribute is not properly mapped to NSLayoutAttributeNotAnAttribute in Objective-C. Or am I doing something totally wrong? TIA, Len [*] Please don't tell me to use NSLayoutConstraint.FromVisualFormat. That method is not applicable to my problem.
_______________________________________________ MonoTouch mailing list [email protected] http://lists.ximian.com/mailman/listinfo/monotouch
