ios - Adding constraint programmatically gives me error -
i'm trying add left , right nslayoutconstraint
view
programmatically. here code:
[self.mainview addconstraints:[nslayoutconstraint constraintswithvisualformat:@"h:|-2.5-[_otherview]-2.5-|" options:0 metrics:nil views:nsdictionaryofvariablebindings(self.otherview)]];
i following error when run app:
terminating app due uncaught exception 'nsinvalidargumentexception', reason: 'unable parse constraint format: _otherview not key in views dictionary.
your argument nsdictionaryofvariablebindings
should _otherview
.
it needs exact string match way refer in constraint visual format.
Comments
Post a Comment