国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > iOS > 正文

Table View Programming Guide for iOS

2019-11-07 23:56:22
字體:
來源:轉載
供稿:網友
目錄:Table View Styles and accessory ViewOverview of the Table View APINavigating a Data Hierarchy with Table ViewsCreating and Configuring a Table ViewA Closer Look at Table View CellsManaging SelectionsInserting and Deleting Rows and SectionsManaging the reordering of rows
Table View Styles and Accessory View
Table View StylePlain StyleGroup Style其實plain通常用于顯示同類的一連貫數據,而Group更適合于用來顯示不同類型的數據。其中plain能有indicator,而group不能有。
Standard Style for Table View CellsUITableView提供四種默認的Cell樣式:UITableViewCellStyleDefaultUITableViewCellStyleSubtitle UITableViewCellStyleValue1UITableViewCellStyleValue2UITableViewCellStyleDefault:UITableViewCellStyleSubtitle :UITableViewCellStyleValue1:UITableViewCellStyleValue2:
Accessory ViewsUITableCell提供三種默認的附件:

Overview of the Table View API
Table View
Table View ControllerUITableViewController自動集成了一個UITableView,所以若需求是一個連續的Table界面,可以直接使用它。
Data Source and Delegate
Extension to the NSIndexPath ClassUITableView通過category的方式擴展了NSIndePath,使其具備row & section屬性來更好地定位TableView的item
Table View Cells

Navigating a Data Hierarchy with Table ViewsUITableView一個最為通用的用法就是用來導航瀏覽一個具有層級關系的數據
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 CellsUITableViewCell設計如下: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。


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 茶陵县| 嵩明县| 瑞昌市| 绩溪县| 白水县| 大足县| 遂平县| 武夷山市| 连江县| 准格尔旗| 连平县| 永定县| 乡城县| 英超| 威海市| 霸州市| 周宁县| 堆龙德庆县| 共和县| 东港市| 宁津县| 思茅市| 嘉义县| 渭南市| 玉溪市| 瑞安市| 荣成市| 苗栗市| 永宁县| 陆良县| 文安县| 商河县| 剑河县| 白城市| 昌黎县| 射阳县| 阿拉善盟| 聊城市| 滦南县| 宾川县| 益阳市|