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

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -