李冬强-用代码写view

王朝学院·作者佚名  2016-08-27
窄屏简体版  字體: 小  |  中  |  大  |  超大  

主要代码

//

// ViewController.m

// 创建view-709

//

// Created by apple on 14-7-9.

// Copyright (c) 2014年 戴维营教育. All rights reserved.

//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {

[super viewDidLoad];

// Do any additional setup after loading the view, typically from a nib.

// CGPoint origin={0,0};

// CGSize size={50,50};

// CGRect rect={origin,size};

UIView *yellView=[[UIView alloc]init];

yellView.frame=CGRectMake(0, 0, 200, 200);

yellView.backgroundColor=[UIColor yellowColor];

[self.view addSubview:yellView];

UIView *whiteView=[[UIView alloc]init];

whiteView.frame=CGRectMake(0, 0, 100, 100);

whiteView.backgroundColor=[UIColor grayColor];

[yellView addSubview:whiteView];

UIView *redView=[[UIView alloc]init];

redView.frame=CGRectMake(100, 100, 100, 100);

redView.backgroundColor=[UIColor redColor];

[self.view addSubview:redView];

}

- (void)didReceiveMemoryWarning {

[super didReceiveMemoryWarning];

// Dispose of any resources that can be recreated.

}

@end

 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
© 2005- 王朝網路 版權所有 導航