/*關於autolayout多說幾句
* 在一個控件內存在autolayout與autoresize子控件時,要適配部分autoresize
* translatesAutoresizingMaskIntoConstraints 默認是打開轉換的
//在autoresize下能夠經過如下代碼進行autolayout視圖的大小計算
if (!contentView.translatesAutoresizingMaskIntoConstraints) {
[contentView needsUpdateConstraints];
[contentView updateConstraints];
CGSize ss = [contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize];
}
//另外若是autolayout視圖在autoresize視圖內部,並且須要配置相對位置,能夠經過如下代碼設置
[autoresizeView removeConstraints:autoresizeView.constraints];//或者只刪除配置內容相關的
NSDictionary *dic = NSDictionaryOfVariableBindings(autolayout);
NSString *VFL = [NSString stringWithFormat:@"V:|-%f-[autolayout]",rect.origin.y];
NSArray *ar = [NSLayoutConstraint constraintsWithVisualFormat:VFL options:0 metrics:nil views:dic];
[autoresizeView addConstraints:ar];
VFL = [NSString stringWithFormat:@"|-%f-[autolayout]",rect.origin.x];
ar = [NSLayoutConstraint constraintsWithVisualFormat:VFL options:0 metrics:nil views:dic];
[autoresizeView addConstraints:ar];
*/spa
還有一種辦法在外面進行計算,給autolayout的視圖加個UIView殼,systemLayoutSizeFittingSize:計算出大小設置到殼上,再放到非autolayout支持的視圖上orm