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 ...
随机推荐
- Telnet 对memcached进行数据操作
连接Telnet 127.0.0.1 11211 存储数据 add news 0 1 8 (news为数据名称,1为存储的时间,当为0的时候则为永久储存,永久缓存最多为30天,8为长度) aaaaaa ...
- line-height与图文对齐 笔记
基本概念: 块:block 特点独行 内联:inline 内联块:inline-block 如果元素display属性默认值为block,则为块元素.如div p 如果元素display属性默认值为i ...
- iOS开发 - 多线程实现方案之GCD篇
GCD概念 GCD为Grand Central Dispatch的缩写,纯c语言编写,是Apple开发的一个多核编程的较新的解决方法.它主要用于优化应用程序以支持多核处理器以及其他对称多处理系统.它是 ...
- linux定时任务报错mysql: command not found
本人在用docker做镜像的时候,把定时任务打到镜像里,但是执行的时候发现错误日志总是报 sh: mysql: command not found ,然后开始解决问题 1)首先确认镜像有没有装mysq ...
- ie img 3px bug
ie img 3px bug 日期:2008-11-22 分类:CSS ie img 有 3px 的缝隙也是 ie 的经典 bug 之一,相信已经不陌生了,但还是先看看效果吧(也许你并没有见过): 效 ...
- SpirngMVC-JSON
Springmvc默认用MappingJacksonHttpMessageConverter对json数据进行转换,需要加入jackson的包,如下: 配置json转换器 在注解适配器中加入messa ...
- 20180607pip install xxx报错SyntaxError invalid syntax
用pip安装时都要在cmd命令行里启动的,而在python中无法运行.退出python运行环境就再执行pip可以了.而且最好用管理员身份运行cmdC:\WINDOWS\system32>cd D ...
- Java内置锁和简单用法
一.简单的锁知识 关于内置锁 Java具有通过synchronized关键字实现的内置锁,内置锁获得锁和释放锁是隐式的,进入synchronized修饰的代码就获得锁,走出相应的代码就释放锁. jav ...
- Redis特点
内存存储,速度极快. 支持的数据类型多,相比较其他的Nosql. 键:字符串 值的六种数据结构:字符串,列表,散列,集合,有序集合,HyperLogLog 附加功能强大
- 文件操作,Io流。
private void textBox1_TextChanged(object sender, EventArgs e) { } private void button1_Click(object ...