美文网首页
当两个或多个视图同时添加头一个视图的时候,会发生什么情况?

当两个或多个视图同时添加头一个视图的时候,会发生什么情况?

作者: iOS开发小学生 | 来源:发表于2017-12-19 18:08 被阅读7次

//视图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];

相关文章

网友评论

      本文标题:当两个或多个视图同时添加头一个视图的时候,会发生什么情况?

      本文链接:https://www.haomeiwen.com/subject/resiwxtx.html