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

#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. 修改oracle重做日志文件大小

    创建3个新的日志组 SQL> ALTER DATABASE ADD LOGFILE GROUP 4 ('/u01/app/oracle/oradata/orcl/redo06.log') SIZ ...

  2. ECMAScript 6中的数组操作方法

    本文介绍ECMAScript 6即将带给我们新的数组操作方法,以及在怎样在现有浏览器应用这些新的数组特性. Note: 我将使用交替使用构造器(constructor)和类(class)两个术语. 类 ...

  3. JS&CSS文件请求合并及压缩处理研究(三)

    上篇我们进行了一些代码方面的准备工作.接下来的逻辑是:在View页面解析时,通过 Html.AppendResFile 方法添加的资源文件,我们需要按照分组.优先级,文件名等条件,对其路径进行合并.具 ...

  4. SQL Server技术问题之视图优缺点

    优点: 一.简单性.视图不仅可以简化用户对数据的理解,也可以简化他们的操作.那些被经常使用的查询可以被定义为视图,从而使用户不必为以后的操作每次都指定全部的条件. 二.安全性.通过视图用户只能查询和修 ...

  5. Struts 2 拦截器

    什么是Struts 2 拦截器  拦截器就是当用户请求后台Action类时在Action的Excute()方法执行前和Result返回魔板试图之后(将页面(数据)发送给浏览器渲染之前)所需要的一些通用 ...

  6. 代码规范之争——[个人Week2作业]

    这四个问题均是出自 http://goodmath.scientopia.org/2011/07/14/stuff-everyone-should-do-part-2-coding-standards ...

  7. Build 2016概览

    很快Microsoft Build 2016马上就要开始,在直播放出来之前,微软已经提前把本次大会期间的所有课程列表放了出来,你可以在这里看到: https://channel9.msdn.com/E ...

  8. vs2015 Android SDK

    It was not possible to complete an automatic installation. This might be due to a problem with your ...

  9. [新手学Java]使用beanUtils控制javabean

    使用BeanUtils设置/读取属性的值以及默认支持的自动转化: @Test //使用BeanUtils设置/读取属性的值以及自动转化 public void test1() throws Illeg ...

  10. [CLR via C#]26. 计算限制的异步操作

    一.CLR线程池基础 前面说过,创建和销毁线程是一个比较昂贵的操作,太多的线程也会浪费内存资源.由于操作系统必须调度可运行的线程并执行上下文切换,所以太多的线程还有损于性能.为了改善这个情况,CLR使 ...