CS193p Lecture 11 - UITableView, iPad
UITableView 的 dataSource 和 delegate
dataSource 是一种协议,由 UITableView 实现,将 Model 的数据给到 UITableView;
delegate 是关于表格是如何显示的,比如:
- 如何排布元素;
- 用哪些视图显示header、footer;
- 如果用户点击某行,如何响应;
dataSource
- numberOfSectionsInTableView
- numberOfRowsInSection
- cellForRowAtIndexPath
create a cell
static NSString *cellIdentifier = @"myCell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier]; // 配置cell中元素的属性
}
delegate
- willDisplayCell
- didEndDisplayingCell
- heightForRowAtIndexPath
- willSelectRowAtIndexPath
- didSelectRowAtIndexPath
UITableView Spinner(网络加载中那个转圈圈)
属性:refreshControl
beginRefreshing
endRefreshing
reloadData
会重载整个表格
reloadRowsAtIndexPath
重载指定行
iPad的特别之处在于,屏幕大,因此有些手机上需要segue到新页面,在iPad上不用
CS193p Lecture 11 - UITableView, iPad的更多相关文章
- 【原】Coursera—Andrew Ng机器学习—课程笔记 Lecture 11—Machine Learning System Design 机器学习系统设计
Lecture 11—Machine Learning System Design 11.1 垃圾邮件分类 本章中用一个实际例子: 垃圾邮件Spam的分类 来描述机器学习系统设计方法.首先来看两封邮件 ...
- CS193p Lecture 10 - Multithreating, UIScrollView
Multithreating(多线程) 网络请求例子: NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithStrin ...
- CS193p Lecture 9 - Animation, Autolayout
Animation(动画) Demo Dropit续 Autolayout(自动布局) 三种添加自动布局的方法: 使用蓝色辅助虚线,右键选择建议约束(Reset to Suggested Constr ...
- CS193p Lecture 8 - Protocols, Blocks and Animation
一.协议(Protocols) 1. 声明协议 @protocol Foo <Xyzzy, NSObject> // ... @optinal // @required //... @en ...
- CS193p Lecture 7 - Views, Gestures
Views 如何绘制自定义图像 Gestures 如何处理用户手势操作 Views 1.它是基本的构造块,代表屏幕上一块矩形区域,定义了一个坐标空间,在此空间中可以绘制,可以添加触控事件: 2.它是分 ...
- CS193p Lecture 6 - UINavigation, UITabBar
抽象类(Abstract):指的是这个类不能被实例化,只能被继承: OC中没有关键词来标明某个类是抽象类,只能在注释中标注一下: 抽象类中的抽象方法,必须是public的,使方法称为public的方法 ...
- CS193p Lecture 5 - View Controller Lifecycle
1. UITextView @property(nonatomic,readonly,retain) NSTextStorage *textStorage 是 NSMutableAttributedS ...
- CS193p Lecture 4 - Foundation, Attributed Strings
消息机制 调用一个实例(instance)的方法(method),就是向该实例的指针发送消息(message),实例收到消息后,从自身的实现(implementation)中寻找响应这条消息的方法. ...
- 【图机器学习】cs224w Lecture 11 & 12 - 网络传播
目录 Decision Based Model of Diffusion Large Cascades Extending the Model Probabilistic Spreading Mode ...
随机推荐
- 51nod1086(多重背包&二進制)
題目鏈接:http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1086 題意:中文題誒- 思路:很顯然這是一道多重背包題,不過這 ...
- Codevs 1312 连续自然数和
1312 连续自然数和 题目描述 Description 对于一个自然数M,求出所有的连续的自然数段,使得这些连续自然数段的全部数字和为M.eg:1998+1999+2000+2001+2002=10 ...
- [Xcode 实际操作]一、博主领进门-(5)检测运行中的模拟器在各个方向上的切换
目录:[Swift]Xcode实际操作 本文将演示Xcode的设备模拟器在各个方向上的切换和检测. 在项目导航区,打开视图控制器的代码文件[ViewController.swift] 检测运行中的模拟 ...
- java数据结构----链表
1.链表:链表是继数组之后第二种使用的最广泛的通用存储结构,它克服了数组的许多弊端:无序数组的查找慢问题,有序数组的插入慢问题,数组定义时的定长问题.它也可取代数组,作为其他数据结构的基础. 2.引用 ...
- 101 to 010 Atcoder CODE FESTIVAL 2017 qual B D
https://www.luogu.org/problemnew/show/AT3575 题解 根本不会.. 错误记录:缺少32行的转移.显然这个转移是必要的 #include<cstdio&g ...
- SecureCRT无法连接虚拟机Linux—虚拟网卡(NAT方式)IP(169.254.xx.xx)无效问题
搞了一晚上,终于解决了http://blog.csdn.net/zengxianyang/article/details/50394809
- 利用HtmlParser解析网页内容
一,htmpparser介绍 htmlparser是一个功能比较强大的网页解析工具,主要用于 html 网页的转换(Transformation) 以及网页内容的抽取 (Extraction). 二, ...
- 安装好的php独立添加扩展模块
在装好php后,或者在使用php的时候,发现某个模块没有添加,而又不想重新编译安装,这时就需要单独添加扩展模块. php环境说明: 安装路径:/data/php5.6/ 解压路径:/data/php- ...
- 转 php include
http://www.w3school.com.cn/php/php_includes.asp PHP include 实例 例子 1 假设我们有一个名为 "footer.php" ...
- 转 OUI and OPatch Do Not Recognize JDK/JRE on Windows
issue 1: 新覆盖的opatch 提示,无法opatch 报错 此时不应有1.6 D:\app\Administrator\product\11.2.0\dbhome_1\OPatch\ocm\ ...