I figured out.
//Given a childView...
NSLayoutConstraint *constraint =[NSLayoutConstraint
constraintWithItem:childView
attribute:NSLayoutAttributeWidth
relatedBy:NSLayoutRelationEqual
toItem:childView
attribute:NSLayoutAttributeHeight
multiplier:4.0/3.0 //Aspect ratio: 4*height = 3*width
constant:0.0f];
[childView addConstraint:constraint];
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…