From 2b653104802fd10194448a8da877d0fb591db348 Mon Sep 17 00:00:00 2001 From: oubaiquan Date: Fri, 18 Oct 2019 10:54:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=8D=87=E7=BA=A7=EF=BC=8CBU?= =?UTF-8?q?G=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MyLayoutDemo/AllTestExampleViewController.m | 32 ++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/MyLayoutDemo/AllTestExampleViewController.m b/MyLayoutDemo/AllTestExampleViewController.m index 8693239..f9dd476 100644 --- a/MyLayoutDemo/AllTestExampleViewController.m +++ b/MyLayoutDemo/AllTestExampleViewController.m @@ -23,7 +23,8 @@ - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = [UIColor whiteColor]; - [self example1]; + // [self example1]; + [self example2]; } - (void)didReceiveMemoryWarning { @@ -95,6 +96,35 @@ -(void)example1 } +-(void)example2 +{ + MyFrameLayout *rootLayout = [MyFrameLayout new]; + rootLayout.myMargin = 0; + [self.view addSubview:rootLayout]; + + // B 视图 + UIScrollView *scrollview = [[UIScrollView alloc] init]; + scrollview.backgroundColor = [UIColor blueColor]; + scrollview.myHorzMargin = 0; + scrollview.wrapContentHeight = YES; + scrollview.heightSize.max(400).min(280); + [rootLayout addSubview:scrollview]; + + // 内容C视图 + MyLinearLayout * backLinear = [MyLinearLayout linearLayoutWithOrientation:MyOrientation_Vert]; + backLinear.backgroundColor = [UIColor greenColor]; + backLinear.myHorzMargin = 0; + backLinear.heightSize.min(280); + backLinear.gravity = MyGravity_Vert_Bottom; + [scrollview addSubview:backLinear]; + + UIView *v = [UIView new]; + v.myHeight = 500; //调整不同的尺寸得到不同的结果。 + v.myWidth = 100; + v.backgroundColor = [UIColor redColor]; + [backLinear addSubview:v]; + +} @end