宽容他人,放过自己。

VFL语句示例

Posted on By anchoriteFili

_headerView = [[UIView alloc] init];
_headerView.frame = CGRectMake(0, 0, WIDTH, 200);
UIImageView *imageView = [[UIImageView alloc] init];
imageView.image = [UIImage imageNamed:@"图片"];
[_headerView addSubview:imageView];
imageView.translatesAutoresizingMaskIntoConstraints = NO;
         
NSArray *hConstranits = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[imageView]-0-|" options:0 metrics:nil views:@{@"imageView":imageView}];
 NSArray *vConstranits = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[imageView]-0-|" options:0 metrics:nil views:@{@"imageView":imageView}];

[_headerView addConstraints:hConstranits];
[_headerView addConstraints:vConstranits];