you need to add the constraints to the parent view of the text view and make sure the auto resizing is not being translated into extra constraints. there is a flag to turn that off. it is on by default.
___ Shawn > On Oct 9, 2013, at 1:33 PM, mobiledev1600 <[email protected]> wrote: > > I have a UITextView added programmatically in a tableview. I would like to > add constraint to it so it will look same in portrait and landscape mode. I > have following code(C#, MonoTouch) but it doesnot work. titleTxt is the > simple textfield added to the cell. > > var rightSpaceConstraint = NSLayoutConstraint.Create (titleTxt, > NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, null, > NSLayoutAttribute.Right, 1.0f, 20f); > var leftSpaceConstraint = NSLayoutConstraint.Create (titleTxt, > NSLayoutAttribute.Leading, NSLayoutRelation.Equal, null, > NSLayoutAttribute.Left, 1.0f, 20f); > > titleTxt.AddConstraints (new NSLayoutConstraint[] {rightSpaceConstraint, > leftSpaceConstraint}); > > How should i add constraint to set left and right spaces. > > > > -- > View this message in context: > http://monotouch.2284126.n4.nabble.com/Add-constraint-to-UITextField-programmatically-tp4658505.html > Sent from the MonoTouch mailing list archive at Nabble.com. > _______________________________________________ > MonoTouch mailing list > [email protected] > http://lists.ximian.com/mailman/listinfo/monotouch _______________________________________________ MonoTouch mailing list [email protected] http://lists.ximian.com/mailman/listinfo/monotouch
