ios - Getting error when adding constraint -
i'm trying set constraint on 2 views
touch each other this:
i tried setting constraints programmatically:
[self addconstraint:[nslayoutconstraint constraintswithvisualformat:@"[_firstview][_secondview]" options:0 metrics:nil views:nsdictionaryofvariablebindings(_firstview, _secondview)]];
but following warning:
incompatible pointer types sending 'nsarray *' parameter of type 'nslayoutconstraint'
what doing wrong?
the addconstraint:
method expect single constraint, constraintswithvisualformat:
returns nsarray
of 0 or more constraints.
try adding s.
[self addconstraints:/*your nslayoutconstraint constraintswithvisualformat: call */];
apple's naming conventions can out here. notice constraintswithvisualformat
plural while addconstraint:
singular (and addconstraints:
plural). use these clue in future.
Comments
Post a Comment