虽然都是代码 , 但是基本都有注释。

#import "ViewController.h"

@interface ViewController ()

/**
* 创建视图
*/
@property(strong,nonatomic) UIView *myView;
@end @implementation ViewController - (void)viewDidLoad {
[super viewDidLoad];
/**
初始化视图
*/
self.myView=[[UIView alloc]initWithFrame:CGRectMake(0, 30, 200, 200)];
/**
* 背景色
*/
self.myView.backgroundColor=[UIColor colorWithRed:1.000 green:0.416 blue:0.882 alpha:1.000];
/**
* 添加子视图到view上
*/
[self.view addSubview:self.myView];
self.view.backgroundColor=[UIColor colorWithRed:0.330 green:1.000 blue:0.096 alpha:1.000];
CGRect rec=self.view.frame;
/**
* frame 相对父视图的坐标位置
*/
NSLog(@"view.frame:%@",NSStringFromCGRect(rec));
// bounds 只显示当前视图的大小 和位置无关(0,0)
NSLog(@"myView.bounds:%@",NSStringFromCGRect(self.myView.bounds));
// center 控件相对于父视图的中心点坐标
NSLog(@"%@",NSStringFromCGPoint(self.myView.center));
/**
* 设置视图的中心点坐标
*/
self.myView.center=CGPointMake(300, 350);
/**
* 改变视图的边界
*/
self.myView.bounds=CGRectMake(0, 0, 50, 50);
/**
* CGAffineTrans 让你在原有的视图上进行各种变换
*/
self.myView.transform=CGAffineTransformMakeTranslation(50, 0); } - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
} @end
#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
[super viewDidLoad]; self.aview=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 200, 200)];
self.aview.backgroundColor=[UIColor colorWithRed:1.000 green:0.305 blue:0.259 alpha:1.000];
self.bview=[[UIView alloc]initWithFrame:CGRectMake(100, 100, 200, 200)];
self.bview.backgroundColor=[UIColor blackColor];
self.cview=[[UIView alloc]initWithFrame:CGRectMake(200, 200, 200, 200)];
self.cview.backgroundColor=[UIColor colorWithRed:0.558 green:0.977 blue:0.584 alpha:1.000];
//添加子视图abc
[self.view addSubview:self.aview];
[self.view addSubview:self.bview];
[self.view addSubview:self.cview];
//插入指定视图 ,在XXX下面
[self.view insertSubview:self.bview belowSubview:self.aview];
//在XXX上面
[self.view insertSubview:self.bview aboveSubview:self.aview];
//在指定插入位置插入子视图
[self.view insertSubview:self.bview atIndex:2];
//在父视图中移除子视图
[self.bview removeFromSuperview];
//交换子视图的索引位置
[self.view exchangeSubviewAtIndex:2 withSubviewAtIndex:3];
//将子视图放在最后
[self.view sendSubviewToBack:self.cview];
//将子视图放在最前
[self.view bringSubviewToFront:self.aview]; } - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
} @end
#import "ViewController.h"

@interface ViewController ()
@property(strong,nonatomic) UILabel *labelName;
@end @implementation ViewController - (void)viewDidLoad {
[super viewDidLoad];
self.labelName=[[UILabel alloc]initWithFrame:CGRectMake(0, 100, 400, 200)];
self.labelName.backgroundColor=[UIColor redColor];
//输入文本
self.labelName.text=@"11135135135135135135";
//文本颜色
self.labelName.textColor=[UIColor blueColor];
//文本对齐方式(居中)
self.labelName.textAlignment=NSTextAlignmentCenter;
//文本字体放大或缩小
self.labelName.font=[UIFont systemFontOfSize:20 weight:20];
//显示行数
self.labelName.numberOfLines=10; [self.view addSubview:self.labelName]; } - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
} @end

UI界面的一些简单控件的更多相关文章

  1. iOS开发UI篇—使用picker View控件完成一个简单的选餐应用

    iOS开发UI篇—使用picker View控件完成一个简单的选餐应用 一.实现效果 说明:点击随机按钮,能够自动选取,下方数据自动刷新. 二.实现思路 1.picker view的有默认高度为162 ...

  2. 2013 duilib入门简明教程 -- 简单控件介绍 (12)

        前面的教程应该让大家对duilib的整体有所映像了,下面就来介绍下duilib具体控件的使用.     由于官方没有提供默认的控件样式,所以我就尽量使用win7或者XP自带的按钮样式了,虽然界 ...

  3. WebForm--j简单控件、简单的登录(怎么链接数据库)

    一.简单控件 1.label:边框(边框的颜色.样式.粗细)  是专门显示文字的,   被编译后是    <span id="Label1">Label</spa ...

  4. (转载)Android UI设计之AlertDialog弹窗控件

    Android UI设计之AlertDialog弹窗控件 作者:qq_27630169 字体:[增加 减小] 类型:转载 时间:2016-08-18我要评论 这篇文章主要为大家详细介绍了Android ...

  5. duilib教程之duilib入门简明教程12.简单控件介绍

    前面的教程应该让大家对duilib的整体有所映像了,下面就来介绍下duilib具体控件的使用.    由于官方没有提供默认的控件样式,所以我就尽量使用win7或者XP自带的按钮样式了,虽然界面比较土鳖 ...

  6. iOS开发UI篇—Quartz2D(自定义UIImageView控件)

    iOS开发UI篇—Quartz2D(自定义UIImageView控件) 一.实现思路 Quartz2D最大的用途在于自定义View(自定义UI控件),当系统的View不能满足我们使用需求的时候,自定义 ...

  7. WinForm界面开发之布局控件"WeifenLuo.WinFormsUI.Docking"的使用

    WinForm界面开发之布局控件"WeifenLuo.WinFormsUI.Docking"的使用 转自:http://www.cnblogs.com/wuhuacong/arch ...

  8. HTML5 Web app开发工具Kendo UI Web中Grid网格控件的使用

    Kendo UI Web中的Grid控件不仅可以显示数据,并对数据提供了丰富的支持,包括分页.排序.分组.选择等,同时还有着大量的配置选项.使用Kendo DataSource组件,可以绑定到本地的J ...

  9. 【2017-05-18】WebForm的Repeater控件和一些简单控件

    一.Repeater控件 1. <%@ %> - 这里面写一些声明和引用的 <%  %> - 编写C#代码的 <%= %> - 往界面上输出一个变量的值 <% ...

随机推荐

  1. c# File 操作

    //1.---------文件夹创建.移动.删除--------- //创建文件夹 Directory.CreateDirectory(Server.MapPath("a")); ...

  2. Android之TextView的Span样式源码剖析

           Android中的TextView是个显示文字的的UI类,在现实中的需求中,文字有各式各样的样式,TextView本身没有属性去设置实现,我们可以通过Android提供的 Spannab ...

  3. [IR] Information Extraction

    阶段性总结 Boolean retrieval 单词搜索 [Qword1 and Qword2]               O(x+y) [Qword1 and Qword2]- 改进: Gallo ...

  4. iOS-多线程-GCD

    一. 名词解释: 1. 进程和线程 进程是指在系统中正在运行的一个应用程序.每个进程之间都是独立的,每个进程均运行在期专用而且受到保护的内存空间中. 线程是指一个进程想要执行任务,就必须要有线程.线程 ...

  5. CentOS6.5菜鸟之旅:安装rpmforge软件库

    一.rpmforge软件库    rpmforge是包含4000多种CentOS软件的软件库,被CentOS社区认为是安全和稳定的软件库. 二.安装rpmforege       1. 在http:/ ...

  6. node生成自定义命令(yargs/commander)

    第一部分可以生成一个自定义命令,例如常见的”express”,yargs和commander则可以在生成的自定义命令上做扩展,yargs将命令扩展成类似express --l xx的形式;而comma ...

  7. Criteria查询数据

    Criteria介绍: Criteria查询是Hibernate提供的一种查询方式,与HQL基于字符串的查询形式完全不同.Hibernate提供了org.hiberanee.Criteria 接口.o ...

  8. 0414-复利计算器6.0.Release

    复利计算器6.0--Release 前言 本次复利计算器的版本更新,主要有以下内容的完善: 1.优化了Web版的页面,提供了更舒服美观的用户体现. 2.新增了移动端(安卓)app版本. 版本信息 项目 ...

  9. c++转C#

    //c++:HANDLE(void   *)          ----    c#:System.IntPtr        //c++:Byte(unsigned   char)     ---- ...

  10. Winform开发框架之客户关系管理系统(CRM)的开发总结系列3-客户分类和配置管理实现

    我在本系列随笔的开始,介绍了CRM系统一个重要的客户分类的展示界面,其中包含了从字典中加载分类.从已有数据中加载分类.以及分组列表中加载分类等方式的实现,以及可以动态对这些节点进行配置,实现客户分类的 ...