i am a newbie in autolayout using code.
addConstaints(NSLayoutConstraint.constraintsWithVisualFormat("H:|-16-[v0]-16-|",options:NSLayoutFormatOptions(), metrics:nil ,views:["v0":thumbnailImageView]))
addConstaints(NSLayoutConstraint.constraintsWithVisualFormat("H:|-16-[v0]-16-|",options:NSLayoutFormatOptions(), metrics:nil ,views:["v0":thumbnailImageView]))
Iam trying to achieve above swift code in Objective C using below code but app crashes on load with below error
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unable to parse constraint format: Expected a view H: |-16-[v0]-16-| ^'
[self addConstraints:[NSLayoutConstraint
constraintsWithVisualFormat:@"H:|-16-[v0]-16-|"
options:0
metrics:nil
views:NSDictionaryOfVariableBindings(thumbnailImageView)]];
[self addConstraints:[NSLayoutConstraint
constraintsWithVisualFormat:@"V:|-16-[v0]-16-|"
options:0
metrics:nil
views:NSDictionaryOfVariableBindings(thumbnailImageView)]];
.....
UIImageView * thumbnailImageView = [[UIImageView alloc] init];
thumbnailImageView.backgroundColor = [UIColor greenColor];
thumbnailImageView.translatesAutoresizingMaskIntoConstraints = false;
[self addSubview:thumbnailImageView];
thumbnailImageView.frame = CGRectMake(0, 0, 100, 100);