在iOS中, 常常會有通過網(wǎng)絡(luò)獲取到數(shù)據(jù)添加到子視圖中, 由于數(shù)據(jù)數(shù)量的不可控性, 可以使用以下方法:
1. 控制器中創(chuàng)建的父視圖testView;
2, 通過父視圖的屬性, 為子視圖添加網(wǎng)絡(luò)數(shù)據(jù), 并對子視圖通過layoutSubViews 進行布局;
3, 在父視圖通過使用[self.testView layoutIfNeeded]獲取到當(dāng)前父視圖最終的frame.