import“ViewController.h"
@interface ViewController()
@end
@implementation ViewController
-(void)viewDidload
{
[super viewDidload];
UIView *redview=[[UIView alloc]init];
redview.frame=CGRectMake(0,0,300,100);
redview.backgroundcolor=[UIColor redColor];
[self.view addSubview:redview];
UIView *greenview=[[UIView alloc]init];
greenview.frame=CGRectMake(0,100,150,100);
greenview.backgroundColor=[UIColor greenColor];
[redview addSubview:greenview];
UIView *whiteview=[[UIView alloc]init];
whiteview.frame=CGRectMake(150,100,150,100);
whiteview.backgroundColor=[UIColor blackColor];
[self.view addSubview:whiteview];
}
用ios代码做view
时间: 2024-10-08 07:51:19