首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

UITableView的根本用法

2012-09-07 
UITableView的基本用法几乎大多数的IOS项目中都可以看得到UITableView 的影子,总结了一下,UITableView是iO

UITableView的基本用法
几乎大多数的IOS项目中都可以看得到UITableView 的影子,总结了一下,UITableView是iOS开发中,使用最广泛的组件之一,通常都用它来展示一列数据 。开始看一下UITableView的基本语法:


一、UITableView有两个代理协议
Protocol UITableViewDataSource:用来给TableView提供数据
Protocal UITableViewDelegate:控制TableView的展示方式以及事件响应
二、实现代理方法
 1、UITableViewDataSource代理方法实现

//cell右边按钮格式typedef enum {    UITableViewCellAccessoryNone,                   // don't show any accessory view没有附件    UITableViewCellAccessoryDisclosureIndicator,    // regular chevron. doesn't track 黑色向右的箭头    UITableViewCellAccessoryDetailDisclosureButton, // blue button w/ chevron. tracks  蓝色附件按钮    UITableViewCellAccessoryCheckmark               // checkmark. doesn't track  复选框,支持选择} UITableViewCellAccessoryType

 //是否加换行线 typedef enum {    UITableViewCellSeparatorStyleNone,    UITableViewCellSeparatorStyleSingleLine} UITableViewCellSeparatorStyle

 //改变换行线颜色 tableView.separatorColor = [UIColor blueColor];


 //系统提供的UITableView也包含了四种风格的布局 typedef enum {    UITableViewCellStyleDefault,     UITableViewCellStyleValue1,    UITableViewCellStyleValue2,    UITableViewCellStyleSubtitle} UITableViewCellStyle;




热点排行