当两个或多个视图同时添加头一个视图的时候,会发生什么情况?
2017-12-19 本文已影响7人
iOS开发小学生
//视图1
self.VV1 = [[UIView alloc] initWithFrame:CGRectMake(10, 10, 100, 100)];
self.VV1.backgroundColor = [UIColor redColor];
[self.view addSubview:self.VV1];
//视图2
self.VV2 = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 200, 200)];
self.VV2.backgroundColor = [UIColor greenColor];
[self.view addSubview:self.VV2];
//视图3
self.VV3 = [[UIView alloc] initWithFrame:CGRectMake(100, 400, 200, 200)];
self.VV3.backgroundColor = [UIColor blueColor];
[self.view addSubview:self.VV3];
//视图2添加视图1
[self.VV2 addSubview:self.VV1];
//视图3添加视图1
[self.VV3 addSubview:self.VV1];