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 ...
随机推荐
- 計蒜課/排澇(Edmond-Karp)
題目鏈接: https://nanti.jisuanke.com/t/36 題意:中文題目誒~ 思路: 最大流模板題.... 關於最大流算法blog: http://www.cnblogs.com/z ...
- Mol Cell Proteomics. |廖文丽| 阿尔兹海默症临床前期的脑脊液中突触蛋白的变化先于神经变性标志物
大家好,本周分享的是发表在Molecular & Cellular Proteomics. 上的一篇关于阿尔兹海默病临床前期生物标志物鉴定的文章,题目是Changes in synaptic ...
- 区间质数查询 luoguP1865
原题 https://www.luogu.org/problemnew/show/P1865 本来get到了一个很好的判断素数的方法 O(玄学常数)https://www.luogu.org/blog ...
- 茅台【思维/数学/剪枝】By cellur925
题目传送门 给你\(n\)根木棍,问有多少种方法,使得选出的三根木棍能组成三角形. 开始想要用搜索的,但是写着写着卡壳了(?),于是改用贪心,开始对拍,觉得很稳,只是最后两个数据可能有点卡.很第一题难 ...
- JTextArea设置滚动条
应将JTextArea置于JScrollPanel中 若要使只有垂直滚动条而没有水平滚动条,使用JTextArea.setLineWrap(true),自动换行. 以下摘自[url]http:// ...
- cmd 查看端口占用情况
netstat -nao|findstr 端口号 打开任务管理器查看
- 解决 mac zsh 所有命令失效
上面的没啥用, 直接看分割线吧, 上面的是第一次遇到这个问题, 没有解决.. zsh: command not found: 参考: https://www.jiloc.com/43492.html ...
- Python type class metaclass
'type' 是 python built-in metaclass 其他继承自 ‘type’的class都可以是 Metaclass 子类可以继承父类的metaclass 然而 __metaclas ...
- css hack 笔记
body{background-color:#000\9;}/*ie*/ body{background-color:#0f0\9\0;}/*ie9及以上*/ body{background-colo ...
- POJ - 2186 Popular Cows tarjain模板题
http://poj.org/problem?id=2186 首先求出所有的强连通分量,分好块.然后对于每一个强连通分量,都标记下他们的出度.那么只有出度是0 的块才有可能是答案,为什么呢?因为既然你 ...