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 ...
随机推荐
- Aufree/trip-to-iOS
https://github.com/Aufree/trip-to-iOS?utm_source=next.36kr.com
- redis连接错误
连接redis错误:ERR Client sent AUTH, but no password is set 2018-07-04 20:33 by robinli, 4367 阅读, 0 评论, 收 ...
- bzoj2502清理雪道
传送门 好题啊,由于每个点既可以进,也可以出,就可以新建一个源点和汇点,对于每个点都连边,然后就是最小流板子了. 代码: #include<cstdio> #include<iost ...
- B. Mancala (Codeforces Round #478 (Div. 2))
#include <bits/stdc++.h> using namespace std; ; typedef long long ll; ll a[maxn]; ll b[maxn]; ...
- SimpleDateFormat 如何安全的使用?
前言 为什么会写这篇文章?因为这些天在看<阿里巴巴开发手册详尽版>,没看过的可以关注微信公众号:zhisheng,回复关键字:阿里巴巴开发手册详尽版 就可以获得. 关注我 转载请务必注明 ...
- arcgis mdb 数据中的shp 如何合并一起
如上操作 一直往下就可以啦 选择数据源 就可以了,然后就可以load 其他数据啦 ,坐标系要一直
- 一个简易的Http请求转发器
这两天一直再看微信开发,临时在我的电脑搭了个IIS服务器做微信开发,外网也能访问了,关键是,调试太麻烦了!! 我写完代码,要将代码发布到IIS才能接收微信消息,可是在这个过程中,我不知道微信发过来的是 ...
- chrome浏览器好用的一些插件
1. Listen 1(听音乐) 2. The Great Suspender(定时释放chrome 打开的页面内存) 3. Similar Web(页面流量分析) 4. Advertising Te ...
- CommonJS与ES6、AMD、CMD比较
Javascript,javascript是一种脚本编程语言,有自己独立的语法与语义,没有javascript,也就没有其他的那些概念了. 关于ES6,可直接理解为javascript的增强版(增加了 ...
- Windows 10下mysql 64位 安装(mysql-5.7.11-winx64安装)
Windows下mysql 64位 安装(mysql-5.7.11-winx64安装) 系统Windows10 安装包mysql-5.7.11-winx64.zip 安装过程中遇到的问题,请留意4.0 ...