Table View Programming Guide for iOS
来源:互联网 发布:淘宝账号管理在哪 编辑:程序博客网 时间:2024/06/05 13:24
目录:
- Table View Styles and Accessory View
- Overview of the Table View API
- Navigating a Data Hierarchy with Table Views
- Creating and Configuring a Table View
- A Closer Look at Table View Cells
- Managing Selections
- Inserting and Deleting Rows and Sections
- Managing the reordering of rows
Table View Styles and Accessory View
Table View Style
- Plain Style
- Group Style
其实plain通常用于显示同类的一连贯数据,而Group更适合于用来显示不同类型的数据。
其中plain能有indicator,而group不能有。
Standard Style for Table View Cells
UITableView提供四种默认的Cell样式:
- UITableViewCellStyleDefault
UITableViewCellStyleSubtitle
- UITableViewCellStyleValue1
- UITableViewCellStyleValue2
UITableViewCellStyleDefault:
UITableViewCellStyleSubtitle
:UITableViewCellStyleValue1:
UITableViewCellStyleValue2:
Accessory Views
UITableCell提供三种默认的附件:
Overview of the Table View API
Table View
Table View Controller
UITableViewController自动集成了一个UITableView,所以若需求是一个连续的Table界面,可以直接使用它。
Data Source and Delegate
Extension to the NSIndexPath Class
UITableView通过category的方式扩展了NSIndePath,使其具备row & section属性来更好地定位TableView的item
Table View Cells
Navigating a Data Hierarchy with Table Views
UITableView一个最为通用的用法就是用来导航浏览一个具有层级关系的数据
Hierarchical Data Models and Table View
View Controller and Navigation-Based Apps
Design pattern for Navigation-Based Apps
Creating and Configuring a Table View
Basic of Table View Creation
A Closer Look at Table View Cells
UITableViewCell设计如下:
Cell有通用模式和编辑模式:
- 通用模式
只有content、accessory View两个部分,acessory通常仅用于显示指示图标,如checkmark。 - 编辑模式
有editing、content、recording三部分,其中editing部分通常用于批量处理,而reordering 部分现在除了可用于重新排序呢,还可以用于删除曹组。
UITabelViewCell提供四种默认的Cell样子,若以下四种不能满足,则需要自定义。
Managing Selections
Inserting and Deleting Rows and Sections
当Cell处于编辑模式,我们可以实现row与section的inset、delete、reorder,批处理四种效果。
以下为client触发编辑模式并进行删除或者插入操作的时序图(时序图的执行顺序是从上而下):
- setEditing:animated = 让table view 进去或者取消编辑模式
- tableView:canEditRowAt = 确认指定的行列是否可以进入编辑模式
- tableView:editingStyleForRowAtIndexPath = 制定某行进行编辑模式,这时候editing control已经显示在界面上了
- tableView:commitEditingStyle:forRowAtIndexPath ,虽然这是一个可选方法,但在需要实现删除或者插入的操作时必须实现,并且得根据情况调用以下方法:
- deleteRowsAtIndexPaths:withRowAnimation:
- insertRowsAtIndexPaths:withRowAnimation:
- 调用完以上方法还需要同时更新数据模型。
Batch Insertion ,Deletion,and Reloading of rows and section
Managing the reordering of rows
当table view收到setEditing:animation: 消息就会发送相同的消息给相应的cell,然后就会触发以下流程:
- table view发送tableView:canMoveRowAtIndexPath给DataSource,执行特定的cell能够显示reordering control。
- 每当一个拖动cell行为完成,tableView:targetIndexPathForMoveFromRowAtIndexPath:toProposedIndexPath:这个delegate方法用于判读这个动作是否效果
- 若上面的方法判定有效,则调用dataSource方法,
tableView:moveRowAtIndexPath:toIndexPath:
更新model。
0 0
- Table View Programming Guide for iOS
- View Programming Guide for iOS
- View Programming Guide for iOS 摘要
- View Programming Guide for iOS读书笔记
- Scroll View Programming Guide for iOS 笔记
- 《View Controller Programming Guide for iOS》笔记
- 《View Programming Guide for iOS》笔记
- Scroll View Programming Guide for iOS 笔记
- 《View Controller Programming Guide for iOS》笔记
- View Controller Programming Guide for iOS--(一)
- View Controller Programming Guide for iOS--(二)
- 《View Controller Programming Guide for iOS》笔记
- 《View Programming Guide for iOS》笔记
- View Programming Guide for IOS:Views笔记
- View Controller Programming Guide for iOS摘要
- View Programming Guide for iOS 摘要
- View Programming Guide for IOS:View and Window Architecture笔记
- iOS 笔记 《View Programming Guide for iOS:Introduction》
- 《linux 命令行大全》读书笔记
- 读书系统
- 小米系统更新后android studio 通过USB安装报错:install_canceled_by_user
- opencv学习之角点检测
- lua 协程,在cocos2dx做战斗的理解
- Table View Programming Guide for iOS
- 解决错误:unable to find valid certification path to requested target
- SSH框架整合注册登录下载链接【转】
- iOS打开应用提示未受信任的企业级开发者
- spring boot 拦截器的实现以及遇到的问题的解决方案
- BLE蓝牙中的安全连接(Secure Connections)
- SIP协议详解&eXosip源码库用法分析
- spring getbean 方法分析
- JavaScript中把赋值运算作为判断条件是什么结果?