//视图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];
网友评论