iOS开发-UI基础第一天

控件概述

1.极常用控件
UILabel - 用于显示文本
UIImageView - 用于显示图片
UIButton - 按钮
2.其他控件
ITextField – 文本输入框
UITextView – 能滚动的文字显示控件
UIProgressView – 进度条
UISlider – 块
UIActivityIndicator – 圈圈
UIAlertView – 对话框(中间弹框
UIActionSheet – 底部弹框
UIScrollView – 滚动的控件
UIPageControl – 分页控件
UITableView – 表格
UICollectionView – 九宫格
UIWebView – 网页显示控件
UISwitch – 开关
UISegmentControl – 选项卡
UIPickerView – 选择器
UIDatePicker – 日期选择器
UIToolbar – 工具条
UINavigationBar – 导航条

UILabel

1.什么是UILabel
UILabel极其常用,功能比较专一:显示文字
2.UILabel的常见属性
@property(nonatomic,copy)   NSString           *text;
显示的文字

@property(nonatomic,retain) UIFont             *font;
字体

@property(nonatomic,retain) UIColor            *textColor;
文字颜色

@property(nonatomic)        NSTextAlignment    textAlignment;
对齐模式(比如左对齐、居中对齐、右对齐)

@property(nonatomic) NSInteger numberOfLines;
文字行数

@property(nonatomic)        NSLineBreakMode    lineBreakMode;
换行模式
3.UIFont类
UIFont介绍:代表字体
UIFont常见方法

+ (UIFont *)systemFontOfSize:(CGFloat)fontSize;   系统默认字体
+ (UIFont *)boldSystemFontOfSize:(CGFloat)fontSize;  粗体
+ (UIFont *)italicSystemFontOfSize:(CGFloat)fontSize;  斜体

UIImageView

1.什么是UIImageView
UIImageView极其常用,功能比较专一:显示图片
2.UIImageView常见的属性

	@property(nonatomic,retain) UIImage *image;
显示的图片
	@property(nonatomic,copy) NSArray *animationImages;
显示的动画图片
	@property(nonatomic) NSTimeInterval animationDuration;
动画图片的持续时间
	@property(nonatomic) NSInteger      animationRepeatCount;
动画的播放次数(默认是0,代表无限播放)

3.UIImageVIew常见方法
- (void)startAnimating; // 开始动画
- (void)stopAnimating; // 停止动画
- (BOOL)isAnimating; // 是否正在执行动画
4.UIImage
一个UIImage对象代表一张图片对象
常见创建方法
	imageName:
	imageWithContentOfFile:

UIButton

1.按钮的作用
可以和用户交互
既能显示图片,也能显示文字
2.按钮的状态
normal(普通状态)
	默认情况(Default)
	对应的枚举常量:UIControlStateNormal
highlighted(高亮状态)
	按钮被按下去的时候(手指还未松开)
	对应的枚举常量:UIControlStateHighlighted
disabled(失效状态,不可用状态)
	如果enabled属性为NO,就是处于disable状态,代表按钮不可以被点击
	对应的枚举常量:UIControlStateDisabled
3.按钮的常见设置
- (void)setTitle:(NSString *)title forState:(UIControlState)state;
设置按钮的文字
	- (void)setTitleColor:(UIColor *)color forState:(UIControlState)state;
设置按钮的文字颜色
	- (void)setImage:(UIImage *)image forState:(UIControlState)state;
设置按钮内部的小图片
	- (void)setBackgroundImage:(UIImage *)image forState:(UIControlState)state;
设置按钮的背景图片
posted @ 2015-11-16 18:13  以梦喂码  阅读(102)  评论(0编辑  收藏  举报