OC开发_Storyboard——UITableView
一、tableView
1、datasource数据源
(1 构造每一个tableVIewCell的方法:cellForRowAtIndexPath,这里的
dequeueReusableCellWithIdentifier会根据识别ID去取storyBoard中的cell,同时这也是利用取缓存中的cell复用

(2 还包含了另外两个方法,numberOfSectionsInTableView 默认是返回1如果不重写它的话;numberOfRowsInSection是没有默认值的,所以实现数据源的时候这个是必须实现的
- (NSInteger)numberOfSectionsInTableView:(UITableView *)sender;
- (NSInteger)tableView:(UITableView *)sender numberOfRowsInSection:(NSInteger)section;
2、delegate 协议,方法有很多,这里仅仅举例两个
(1 比如用户点了哪一行?做了什么操作?
- (void)tableView:(UITableView *)sender didSelectRowAtIndexPath:(NSIndexPath *)path
(2 每个cell的图标的点击如下图:
- (void)tableView:(UITableView *)sender accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath 
3、segue 点击cell跳转的时候,
比如跳转到另外一个segue,那么对应的 prepareForSegue就应该知道是哪一个cell的点击,所以sender参数就起到了这个作用
我们可以利用 NSIndexPath *indexPath = [self.tableView indexPathForCell:sender];

4、加载中的spinner
@property (strong) UIRefreshControl *refreshControl;
开启加载动画: - (void)beginRefreshing;
结束加载动画:- (void)endRefreshing;
当然需要启动配置:

5、reloadData重新加载数据
- (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animationStyle;
详情的tableView方法可以参考之前写的这篇文章:http://www.cnblogs.com/daomul/p/4370128.html
OC开发_Storyboard——UITableView的更多相关文章
- OC开发_Storyboard——MapKit
一.Core Location 1.基本对象 @propertys: coordinate, altitude, horizontal/verticalAccuracy, timestamp, sp ...
- OC开发_Storyboard——iPad开发
iPad开发(Universal Applications) 一.iPad 1.判断是否在iPad上 BOOL iPad = ([[UIDevice currentDevice] userInterf ...
- OC开发_Storyboard——Core Data
一 .NSManagedObjectContext 1.我们要想操作Core Data,首先需要一个NSManagedObjectContext2.那我们如何获得Context呢:创建一个UIMana ...
- OC开发_Storyboard——AutoLayout
一.autolayout 自动布局: 1. 设置所有视图框架的三种方法,可以通过代码创建也可以storyboard设置 = 规则 (1 蓝线+约束:(位置) 使用蓝线,根据蓝线拖动控件,只是告诉Xco ...
- OC开发_Storyboard——多线程、UIScrollView
一.多线程 1.主队列:处理多点触控和所有UI操作(不能阻塞.主要同步更新UI) dispatch_queue_t mainQueue = dispatchg_get_main_queue(); // ...
- OC开发_Storyboard——UIApplication和网络活动指示器
一.UIApplication 只有一个实例: UIApplication *myApplication = [UIApplication sharedApplication]; 属性如果设置为YES ...
- OC开发_Storyboard——绘制和视图
1.绘制 不要调用drawRect.调用setNeedsDisplay相当于告知系统视图需要重绘, 它会去调用drawRect,更新屏外缓冲器 2.UIBezierPath绘制图形, 设置图像op ...
- OC开发_Storyboard——block和动画
一.协议 @optional :可选的 @requied :必须实现的 二.block 代码块 1. 以一个^开头,然后是参数,然后是一个大括号,包含我们的代码块 [aDictionary enu ...
- OC开发_Storyboard——NaviationController简单例子
一个简单的Navigation的例子,demo里面用到了上一个demo的MVC,可以参考下:http://www.cnblogs.com/daomul/p/4426063.html 建立一个Nav其实 ...
随机推荐
- 散货:null 强转 和 iOS null崩溃
问题1 在看 SpringMVC源码剖析(五)-消息转换器HttpMessageConverter 的时候,在 org.springframework.web.servlet.mvc.method ...
- 在 C++ 程序中只使用 const 常量而不使用宏常量
在 C++ 程序中只使用 const 常量而不使用宏常量,即 const 常量完 全取代宏常量. #include <iostream> /* run this program using ...
- javascript -- addEventListener()和removeEventListener
addEventListener()与removeEventListener()用于处理指定和删除事件处理程序操作.所有的DOM节点中都包含这两种方法,并且它们都接受3个参数:要处理的事件名.作为事件 ...
- par函数的bg参数-控制图片的背景色
bg 参数用于控制图片的背景色,默认为白色 代码示例: par(bg = "pink") plot(1:5, 1:5, main = "title", xlab ...
- Linux,ubuntu14.04.5下安装软件
没有aptitude 使用: sudo apt-get install ***
- json格式的javascript对象用法分析
格式: objectName = { property1:value1, property2:value2, …, propertyN:valueN } property是对象的属性 ,val ...
- VC++ 6.0开发套件(自己收藏!)
安装镜像ISO VC++ 6.0_SP6_Win7企业版(中英文集成).iso MSDN安装镜像ISO MSDN_Oct_200 ...
- brew 的 调度工具DBGPRINTF 和 c语言的 printf
在官方的文档中是这样备注DBGPRINTF Prototype void dbgprintf(const char *pszFormat,...); Description This function ...
- swift - UISegmentedControl 的用法
一.创建控件,并监听控件选择值 /*选项除了文字还可以是图片 as关键字的作用就是字面意思:类型转换*/ let items = ["选项一", "选项二", ...
- Windows版Nginx启动失败之1113: No mapping for the Unicode character exists in the target multi-byte code page
Windows版Nginx启动一闪,进程中未发现nginx进程,查看nginx日志,提示错误为1113: No mapping for the Unicode character exists in ...