//加上头部 和底部

- (void)viewDidLoad
{
[super viewDidLoad]; [self tableView]; // 设置行高
self.tableView.rowHeight = ; // 分隔线
self.tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
/**
32位真彩色 ARGB 2^8 * 2^8 * 2^8 * 2^8 = 2^32 = 2^2 * 2^10 * 2^10 * 2^10 = 4G
2^64 = 16 GG A = Alpha
R
G
B
24位真彩色 RGB 2^8 * 2^8 * 2^8 = 2 ^ 24 = 2^4 * 2^10 = 16 * 100万
R = Red 1个字节 8位 0~255
G = Green
B = Blun # ff ff ff ff
*/
self.tableView.separatorColor = [UIColor colorWithWhite:0.0 alpha:0.2]; // headView,放在tableView最顶部的视图,通常用来放图片轮播器
UIView *head = [[UIView alloc] initWithFrame:CGRectMake(, , , )];
head.backgroundColor = [UIColor blueColor];
self.tableView.tableHeaderView = head; // footerView,通常做上拉刷新
UIView *foot = [[UIView alloc] initWithFrame:CGRectMake(, , , )];
foot.backgroundColor = [UIColor redColor];
self.tableView.tableFooterView = foot;
}

//优化 cell 复用view

 // 0. 可重用标示符字符串
// static静态变量,能够保证系统为变量在内存中只分配一次内存空间
// 静态变量,一旦创建,就不会被释放,只有当应用程序被销毁时,才会释放!
static NSString *ID = @"Cell"; // 1. 取缓存池查找可重用的单元格
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID]; // 2. 如果没有找到
if (cell == nil) {
NSLog(@"实例化单元格");
// 创建单元格,并设置cell有共性的属性 // 实例化新的单元格
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID]; // 右侧箭头
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; // 背景颜色,会影响到未选中表格行的标签背景
// cell.backgroundColor = [UIColor redColor];
// 在实际开发中,使用背景视图的情况比较多
// 背景视图,不需要指定大小,cell会根据自身的尺寸,自动填充调整背景视图的显示
// UIImage *bgImage = [UIImage imageNamed:@"img_01"];
// cell.backgroundView = [[UIImageView alloc] initWithImage:bgImage];
// UIView *bgView = [[UIView alloc] init];
// bgView.backgroundColor = [UIColor yellowColor];
// cell.backgroundView = bgView;
// 没有选中的背景颜色
// 选中的背景视图
// UIImage *selectedBGImage = [UIImage imageNamed:@"img_02"];
// cell.selectedBackgroundView = [[UIImageView alloc] initWithImage:selectedBGImage];
}

IOS第七天(4:UiTableView 数据的显示优化重复实例和tableFooterView和tableHeaderView)的更多相关文章

  1. IOS第七天(3:UiTableView 模型和数据的分组的显示)

    *************UiTableView模型和数据的分组的显示 #import "HMViewController.h" #import "HMHero.h&qu ...

  2. IOS第七天(2:UiTableView 加上数据分离)

    ****加上数据分离 #import "HMViewController.h" #import "HMStudent.h" @interface HMViewC ...

  3. IOS第七天(6:UiTableView编辑模式, 拖动位置 ,滑动删除)

    **********UiTableView编辑模式, 拖动位置 ,滑动删除 #import "HMViewController.h" @interface HMViewContro ...

  4. IOS第七天(5:UiTableView 汽车品牌,复杂模型分组展示,A-Z索要列表) (2015-08-05 14:03)

    复杂模型分组展示 #import "HMViewController.h" #import "HMCarGroup.h" #import "HMCar ...

  5. IOS第七天(1:UiTableView 的基本用法)

    ***表格控件 #import "HMViewController.h" @interface HMViewController () <UITableViewDataSou ...

  6. iOS全埋点解决方案-UITableView和UICollectionView点击事件

    前言 在 $AppClick 事件采集中,还有两个比较特殊的控件: UITableView •UICollectionView 这两个控件的点击事件,一般指的是点击 UITableViewCell 和 ...

  7. iOS开发UI篇—实现UItableview控件数据刷新

    iOS开发UI篇—实现UItableview控件数据刷新 一.项目文件结构和plist文件 二.实现效果 1.说明:这是一个英雄展示界面,点击选中行,可以修改改行英雄的名称(完成数据刷新的操作). 运 ...

  8. iOS开发UI篇—使用UItableview完成一个简单的QQ好友列表(一)

    iOS开发UI篇—使用UItableview完成一个简单的QQ好友列表(一) 一.项目结构和plist文件 二.实现代码 1.说明: 主控制器直接继承UITableViewController // ...

  9. iOS开发UI篇—在UITableview的应用中使用动态单元格来完成app应用程序管理界面的搭建

    iOS开发UI篇—在UITableview的应用中使用动态单元格来完成app应用程序管理界面的搭建 一.实现效果 说明:该示例在storyboard中使用动态单元格来完成. 二.实现 1.项目文件结构 ...

随机推荐

  1. hdu1503 最长公共子序列变形

    题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=1503 题意:给出两个字符串 要求输出包含两个字符串的所有字母的最短序列.注意输出的顺序不能 ...

  2. SQL初级

    SQL是一个微软开发的数据库,因为联系到很多内部服务程序和文件所以安装和删除的时候有些人会遇上些麻烦,如果安装失败了那就得完全删除后重装,然而他自己自带的删除系统并不是那么给力,所以悲剧就诞生了,不行 ...

  3. jQuery-认识JQuery,jQuery选择器

    认识JQuery: 1.window.onload与$(document).ready()的区别 window.onload $(document).ready() 执行时机 必须等待网页中的所有内容 ...

  4. How to: 执行Action当收到数据时

      本文旨在演示ActionBlock的使用. 大致流程: 输入路径--读取字节--计算--传输到打印   // Demonstrates how to provide delegates to ex ...

  5. underscore.js依赖库函数分析二(查找)

    查找: 在underscore.js封装了对dom查找的操作,find()和filter()函数,find()函数的查找操作是返回首个与条件相符的元素值,filter()函数是找到与条件相符的所有元素 ...

  6. BZOJ3726 : PA2014Final Wykladzina

    从上到下枚举下底边,维护$a[i]$表示$i$向上延伸多少距离里面没有坏点,$b[i]$表示$i$向上延伸多少距离里面最多只有1个坏点. 设$l0[i],r0[i]$表示以$a[i]$为最小值,往左往 ...

  7. <fieldset>

    legend{text-align:center;} <fieldset> <legend>爱好<legend>(为fieldset定义标题) <input ...

  8. Codeforces Round #210 (Div. 2) A. Levko and Table

    让对角线的元素为k就行 #include <iostream> using namespace std; int main() { int n,k; cin >> n > ...

  9. 【HDU】4089 Activation

    http://acm.hdu.edu.cn/showproblem.php?pid=4089 题意: 有n个人排队等着在官网上激活游戏.主角排在第m个. 对于队列中的第一个人.有以下情况:1.激活失败 ...

  10. 【BZOJ】2741: 【FOTILE模拟赛】L

    题意:给定一个长度为n的序列,m次询问,每次询问一个区间[l, r],求max(Ai xor Ai+1 xor Ai+2 ... xor Aj),其中l<=i<=j<=r.(n< ...