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

#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. bat 结束进程

    @echo offEcho 先等待7秒..等待启动其他软件ping 127.0.0.1 -n 60Echo 正在杀死进程...taskkill /f /im funshion.exetaskkill ...

  2. MeshCombineUtility.cs method `GetTriangleStrip' of type `UnityEngine.Mesh' could be found

    1) Assets/Standard Assets/Scripts/MeshCombineUtility.cs(27,74): error CS1061: Type `UnityEngine.Mesh ...

  3. Unity 摄像机Clear Flags和Culling Mask属性用途详解

    原文地址:http://blog.csdn.net/tanmengwen/article/details/8798231 1.简述两个属性 1.1 Clear Flags 清除标记 每个相机在渲染时会 ...

  4. C#中处理耗时任务的几种方式

    0.准备 首先,我们先创建几个耗时任务: public class TestTasks { //无参.无返回值任务 public void Task1() { Console.WriteLine(&q ...

  5. 一个ListView布局的不断演化

    刚出来工作,就负责一个APP的某块功能的编写,该功能就是类似微博那样的界面.微博界面的编写实际上是非常复杂的,虽然它只是一个ListView,但要想让这个ListView滑得动,是的,在一些配置低的手 ...

  6. 复利计算v6.0--web版--软件工程

    一.结对同伴 姓名:蔡舜 学号: 博客园地址:http://www.cnblogs.com/caishun/ http://www.cnblogs.com/caishun/p/5392896.html ...

  7. C# FTP远程服务器返回错误:(550) 文件不可用(例如,未找到文件,无法访问文件)

    今天用代码删除FTP服务器上的目录时候,报错:远程服务器返回错误:(550) 文件不可用(例如,未找到文件,无法访问文件). 习惯性的google,不外乎以下几点: 1.URL路径不对,看看有没有多加 ...

  8. 重新想象 Windows 8.1 Store Apps (72) - 新增控件: AppBar, CommandBar

    [源码下载] 重新想象 Windows 8.1 Store Apps (72) - 新增控件: AppBar, CommandBar 作者:webabcd 介绍重新想象 Windows 8.1 Sto ...

  9. Yii2学习笔记之场景

    场景 一个模型可能在多个场景中使用,在不同的场景中,模型可能使用不同的业务逻辑和规则.例如, User 模型可能在用户登录时使用,也可能在用户注册时使用,某些属性可能在用户注册时强制要求有,在用户登录 ...

  10. Java Web Cookie

    一.什么是cookie? 1.Cookie能使站点跟踪特定访问者的访问次数.最后访问时间和访问者进入站点的路径 2.Cookie能告诉在线广告商广告被点击的次数,从而可以更精确的投放广告 3.Cook ...