FPLinearLayoutView 允许您在不关心位置的情况下添加一个视图作为子视图。FPLinearLayoutView 将处理所有添加的视图,并将它们放置在正确的地方(根据选择的方向)。这基本上使得 UIView 像安卓的线性布局一样工作。
// Horizontal oriented layout.
FPLinearLayoutView *layoutView = [FPLinearLayoutView horizontalLayout];
// Appending view with default margin.
UIView* view = [[UIView alloc] initWithFrame:CGRect(0, 0, 320, 100)];
[layoutView appendView:view]
// Appending view with specific margins.
UIView* view = [[UIView alloc] initWithFrame:CGRect(0, 0, 320, 100)];
[layoutView appendView:view marginLeft:10.0f marginTop:20.0f];