UILable

 1  //设置文本信息
2 nameLable.text = @"用户名:";
3 //对齐方式(居中 居左 局右);
4 nameLable.textAlignment = NSTextAlignmentRight;
5 //设置文本内容颜色
6 nameLable.textColor = [UIColor blackColor];
7 //设置文本字体
8 nameLable.font = [UIFont fontWithName:@"Helvetica-Bold" size:20];
9 //打印所有字体样式
10 NSLog(@"%@",[UIFont familyNames]);
11 //设置行数
12 nameLable.numberOfLines = 0;
13 //断行模式
14 nameLable.lineBreakMode = NSLineBreakByWordWrapping;//按照单词换行
15 //阴影颜色
16 nameLable.shadowColor = [UIColor blueColor];
17 //阴影大小
18 nameLable.shadowOffset = CGSizeMake(2, 1);

UITextField

 1     //背景颜色
2 textField.backgroundColor = [UIColor greenColor];
3 //文本内容
4 textField.text = @"用户名";
5 //设置文本内容颜色
6 textField.textColor = [UIColor redColor];
7 //文本对齐方式
8 textField.textAlignment = NSTextAlignmentCenter;
9 //边框样式
10 textField.borderStyle = UITextBorderStyleRoundedRect;
11 //设置占位符
12 textField.placeholder = @"请输入用户名";
13 //是否允许编辑
14 textField.enabled = YES;
15 //开始编辑时是否清空输入框
16 textField.clearsOnBeginEditing = YES;
17 //是否安全输入
18 textField.secureTextEntry = YES;
19 //设置键盘样式
20 textField.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
22 textField.returnKeyType = UIReturnKeySearch;
23 //自定义视图
24 UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 414, 100)];
25 view.backgroundColor = [UIColor cyanColor];
26 // textField.inputView = view;
27 //输入框上边的内容
28 textField.inputAccessoryView = view;
29 //清除按钮模式(x)
30 textField.clearButtonMode = UITextFieldViewModeWhileEditing;
32 [textField becomeFirstResponder];//成为第一响应者

UIButton

1  button.frame = CGRectMake(50, 100, 300, 300);
2 button.backgroundColor = [UIColor orangeColor];
3 //设置标题 普通状态下
4 [button setTitle:@"点 我" forState:UIControlStateNormal];
5 //高亮状态下 (点住的时候)
6 [button setTitle:@"谁点我" forState:UIControlStateHighlighted];
7 //设置标题颜色
8 button.tintColor = [UIColor whiteColor];

1 //添加事件 2 3 [button addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside];

UIPageControl

 1 self.page = [[UIPageControl alloc] initWithFrame:CGRectMake(100, 636, 214, 40)];
3 self.page.backgroundColor = [UIColor grayColor];
4 // 设置小圆点个数
5 self.page.numberOfPages = 4;
7 // 设置当前显示的页数
8 self.page.currentPage = 2;
10 // 设置未选中的圆点颜色
11 self.page.pageIndicatorTintColor = [UIColor greenColor];
12 // 设置选中的圆点颜色
13 self.page.currentPageIndicatorTintColor = [UIColor redColor];
15 [self.page addTarget:self action:@selector(fangfang:) forControlEvents:UIControlEventValueChanged];
16 [self.view addSubview:self.page];

UISegmentControl

 1 // 创建对象
2 self.segment = [[UISegmentedControl alloc] initWithItems:@[@"女神", @"男神", @"屌丝"]];
4 // 设置属性
5 self.segment.backgroundColor = [UIColor orangeColor];
6 self.segment.frame = CGRectMake(50, 100, 300, 50);
8 // 指定被选中的分段
9 self.segment.selectedSegmentIndex = 0;
10 // 样式颜色
11 self.segment.tintColor = [UIColor redColor];
12 //设置标题
13 [self.segment setTitle:@"阿福" forSegmentAtIndex:2];

UISlider

 1 // 1.创建对象
2 self.mySlider = [[UISlider alloc] initWithFrame:CGRectMake(7, 50, 400, 40)];
3
4 // 2.设置属性
5 self.mySlider.backgroundColor = [UIColor blackColor];
6 // 设置slider的最小值
7 self.mySlider.minimumValue = 0;
8 // 设置slider的最大值
9 self.mySlider.maximumValue = 10;
14 // 设置按钮颜色
15 self.mySlider.thumbTintColor = [UIColor redColor];
17 // 设置划过区域的颜色
18 self.mySlider.minimumTrackTintColor = [UIColor yellowColor];
19 // 设置未划过区域的颜色
20 self.mySlider.maximumTrackTintColor = [UIColor orangeColor];

UISwitch

 1 // 1.创建对象
2 // 设置frame只有(X.Y)起作用,size使用系统默认大小
3 UISwitch *switchButton = [[UISwitch alloc] initWithFrame:CGRectMake(300, 100, 100, 100)];
4 // 2.设置属性
5 switchButton.backgroundColor = [UIColor blackColor];
6 // 设置开关样式的颜色
7 switchButton.tintColor = [UIColor redColor];
8 // 设置开启时的颜色
9 switchButton.onTintColor = [UIColor blueColor];
10 // 设置开关按钮的颜色
11 switchButton.thumbTintColor = [UIColor cyanColor];
12 //设置程序运行之后开关的状态(开启还是关闭)
13 [switchButton setOn:YES animated:YES];

UIScorllView

   / * *
* 第一步:将scrollView添加到rootView上,使视图可以滚动
*/
self.scrollView = [[UIScrollView alloc] initWithFrame:self.frame];
self.scrollView.backgroundColor = [UIColor cyanColor];
[self addSubview:self.scrollView];
/**
10 * 第二步:将需要滚动的图片添加到scrollView上
11 */
self.myImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@""]];
// UIImageView不设置frame时候默认使用图片大小
[self.scrollView addSubview:self.myImageView];
// 设置滚动范围
self.scrollView.contentSize = self.myImageView.frame.size;
// 设置是否显示水平滚动条
self.scrollView.showsHorizontalScrollIndicator = NO;
// 设置是否显示垂直方向滚动条
self.scrollView.showsVerticalScrollIndicator = NO;
// 设置是否回弹
self.scrollView.bounces = YES;
 1 // 设置水平方向滚动
2 self.scrollView.contentSize = CGSizeMake(self.myImageView.frame.size.width, 0);
4 // 设置垂直方向滚动
5 self.scrollView.contentSize = CGSizeMake(0, self.myImageView.frame.size.height);
8 // 设置偏移量,规定要显示的位置
9 self.scrollView.contentOffset = CGPointMake(400, 100);
12 // 设置缩放
13 // 设置最小的缩放比例
14 self.scrollView.minimumZoomScale = 0.1;
15 // 设置最大的缩放比例
16 self.scrollView.maximumZoomScale = 2;
 

UI常用控件的一些属性的更多相关文章

  1. UI常用控件

    UICommonlyUsedControls [UI常用控件] 不需要学习多么深入,但是要知道系统提供的有用的控件. 一.UISwitch(开关) 二.UIActivityIndicatorView( ...

  2. Andriod常用控件介绍&相关属性(初学方便查询)

    一.TextView(显示控件) android:id(给当前控件定义唯一的标识符)——示例:android:id = "@+id/text_view" android:layou ...

  3. easy ui 常用控件配置

    table comboBox 下拉高度 panelHeight:'auto' textBox

  4. 【Android Studio】安卓开发初体验3.1——UI设计之常用控件

    常用控件 首先对xml文件的编辑有三种模式 Code为纯代码 Split是一边代码,一边预览效果图 Designer就是有UI设计界面 TextView 用于在界面上显示一段文本信息 所有控件都可以在 ...

  5. [WinForm]WinForm跨线程UI操作常用控件类大全

    前言 在C#开发的WinForm窗体程序开发的时候,经常会使用多线程处理一些比较耗时之类的操作.不过会有一个问题:就是涉及到跨线程操作UI元素. 相信才开始接触的人一定会遇上这个问题. 为了解决这个问 ...

  6. winFrom 常用控件属性及方法介绍

    目录 1.窗体(Form) 2.Label (标签)控件 3.TextBox(文本框)控件 4.RichTextBox控件 5.NumericUpDown控件 6.Button(按钮)控件 7.Gro ...

  7. Android中常用控件及属性

    在之前的博客为大家带来了很多关于Android和jsp的介绍,本篇将为大家带来,关于Andriod中常用控件及属性的使用方法,目的方便大家遗忘时,及时复习参考.好了废话不多讲,现在开始我们本篇内容的介 ...

  8. MFC学习 标签页与属性页及各常用控件使用

    参考 http://blog.csdn.net/anye3000/article/details/6700023 CTabCtrl: BOOL CTabTestDlg::OnInitDialog() ...

  9. WPF 10天修炼 第六天- 系统属性和常用控件

    WPF系统属性和常用控件 渐变的背景色 WPF中的前景色和背景色不同于传统Winform的设置,这些属性都是Brush类型的值.在XAML中,当为这些属性设置指定的颜色后将被转换为SolidColor ...

随机推荐

  1. BootStrap 智能表单系列 首页 (持续更新中...)

    背景:本码农.NET后端工程师,在项目开发中发现写了很多重复的代码, 于是自己整了一套根据配置来生成form表单的插件,针对表单的改动仅需要修改配置的json即可 使用中发现还是蛮实用的,于是开源出来 ...

  2. SQL Server 2012学习笔记 1 命令行安装

    setup.exe /Q /IACCEPTSQLSERVERLICENSETERMS /ACTION=install /PID=748RB-X4T6B-MRM7V-RTVFF-CHC8H /FEATU ...

  3. JavaSE学习总结第26天_网络编程

      26.01  网络编程概述 网络编程:就是用来实现网络互连的不同计算机上运行的程序间可以进行数据交换. 26.02  网络模型概述和图解 计算机网络之间以何种规则进行通信,就是网络模型研究问题. ...

  4. 简单十步让你全面理解SQL

    很多程序员认为SQL是一头难以驯服的野兽.它是为数不多的声明性语言之一,也因为这样,其展示了完全不同于其他的表现形式.命令式语言. 面向对象语言甚至函数式编程语言(虽然有些人觉得SQL 还是有些类似功 ...

  5. linux怎样修改用户权限

    ls -l  查看目录下的文件详细信息 ll 同上 whoami 功能说明:先似乎用户名称. 语 法:whoami [--help][--version] 补充说明:显示自身的用户名称,本指令相当于执 ...

  6. Hibernate的搭建及使用

    1.创建普通的java项目. 因为Hibernate是一个轻量级的框架,不像servlet,还必须需要tomcat的支持,Hibernate只要jdk支持即可. 2.引入jar包. 可以在项目中直接引 ...

  7. 高性能javascript 学习笔记(1)

    加载和运行 管理浏览器中的javascript代码是个棘手的问题,因为代码运行阻塞了其他浏览器处理过程,诸如用户绘制,每次遇到<script>标签,页面必须停下来等待代码下载(如果是外部的 ...

  8. LeapMotion 简介

    Leap Motion Overview Leap Motion是一种检测和跟踪hands, fingers and finger-like tools的设备.该设备在一个较近的环境中操作,精度高,跟 ...

  9. Pascal向C++的跨越

    最近从pas转向了C++,觉得需要在语言上总结对比一下,以及记录一些注意点,关于STL,还需要之后好好地学习.同时,希望这篇文章对从pas转C++的同学有所帮助. 基本类型 首先是基本类型的比较: P ...

  10. oracle数据类型和对应的java类型

    由于 实体类里面 使用的是 double ,生成的Oracle  用的JDBC 类型为java.sql.Types.FLOAT 所以Oracle 数据类型为 float. 如果想保留两位小数 实体类 ...