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 ...
随机推荐
- Metabolic Signatures of Cystic Fibrosis Identified in Dried Blood Spots For Newborn Screening Without Carrier Identification (文献分享一组-孔楠楠)
题目:Metabolic Signatures of Cystic Fibrosis Identified in Dried Blood Spots For Newborn Screening Wit ...
- windows如何搭建redis集群
操作系统:win10 64位 redis版本:3.2.1-x64 ruby版本:2.5.1-1-x64 rubygems版本:2.7.6 今天突然想简单的搭建一个redis的集群,因为系统是Windo ...
- C笔记列表
笔记列表 指针是一个变量,其值为另一个变量的地址,即,内存位置的直接地址.就像其他变量或常量一样,您必须在使用指针存储其他变量地址之前,对其进行声明. 要理解指针就要先理解计算机的内存.计算机内存会被 ...
- react-native-wechat微信组件的使用
对我来说link没有成功过,所以参考了其他人的文章,原文:https://www.jianshu.com/p/6a792118fae4 第一步:要去:https://open.weixin.qq.co ...
- hibernate下载
- cmd,bat和dos的区别
区别 dos是磁盘操作系统(Disk Operating System),是个人计算机上的一类操作系统. bat是DOS命令,在任何dos环境下都可以使用. bat文件是dos下的批处理文件,批处理文 ...
- pycharm 中切换虚拟环境
在pycharm上创建虚拟环境,网上的资料非常多. 如果pycharm上有多个项目,如何切换每个项目的虚拟环境? cmd 命令进入虚拟环境所在的文件夹(Pycharm在每创建一个新项目时就会创建一个虚 ...
- bzoj 2441 [中山市选2011]小W的问题
bzoj 2441 [中山市选2011]小W的问题 Description 有一天,小W找了一个笛卡尔坐标系,并在上面选取了N个整点.他发现通过这些整点能够画出很多个"W"出来.具 ...
- 15 使用lambdas和闭包
1 使用lambdas和闭包 1.1 定义闭包 闭包是一个代码块,代替了方法或类. groovy中的闭包基于后边的构造方式:{list of parameters-> closur ...
- 106 Construct Binary Tree from Inorder and Postorder Traversal 从中序与后序遍历序列构造二叉树
给定一棵树的中序遍历与后序遍历,依据此构造二叉树.注意:你可以假设树中没有重复的元素.例如,给出中序遍历 = [9,3,15,20,7]后序遍历 = [9,15,7,20,3]返回如下的二叉树: ...