_ima1 = [[UIImageView alloc]initWithFrame:CGRectZero];
_ima1.translatesAutoresizingMaskIntoConstraints = NO;
[vi addSubview:_ima1];
// _ima1.frame = CGRectMake(300 , 10, 50, 50) ;
NSDictionary *contraintDict = NSDictionaryOfVariableBindings(_ima1,vi);
NSArray *contraints1 = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[_ima1(50)]-(20)-|" options:0 metrics:nil views:contraintDict];
NSArray *contraints2 = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|-(10)-[_ima1(50)]" options:0 metrics:nil views:contraintDict];
[vi addConstraints:contraints1];
[vi addConstraints:contraints2];
网友评论