Reputation: 5104
Trying my hand at the visual format language for iOS but I'm getting a sigabrt when trying to initialize the constraints. Any glaring issues with this code?
NSNumber *inset = [NSNumber numberWithFloat:TopBarInsetWidth];
NSNumber *width = [NSNumber numberWithFloat:TopBarButtonWidth];
NSNumber *height = [NSNumber numberWithFloat:TopBarButtonHeight];
NSDictionary *metrics = NSDictionaryOfVariableBindings(inset,width,height);
NSDictionary *viewsDictionary = NSDictionaryOfVariableBindings(self.backButton);
NSArray *constraints =[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-inset-[self.backButton(=width)]|" options:0 metrics:metrics views:viewsDictionary];
Upvotes: 0
Views: 722
Reputation: 5104
For some reason Xcode was not giving me any kind of stack trace and was instead defaulting to sigabrting. I solved this by wrapping the code into try/catch blocks and breaking on the catch handler which then properly output my error.
Upvotes: 1
Reputation: 570
use this:
NSArray *constraints =[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-inset-[self.backButton(==width)]|" options:0 metrics:metrics views:viewsDictionary];
Upvotes: 0