国产探花免费观看_亚洲丰满少妇自慰呻吟_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。


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 大理市| 建昌县| 武宣县| 九龙县| 建湖县| 调兵山市| 鹿泉市| 宁化县| 进贤县| 平湖市| 甘肃省| 肇源县| 织金县| 曲阳县| 和平县| 日喀则市| 芒康县| 恭城| 永清县| 江山市| 阜南县| 奉贤区| 建湖县| 尼勒克县| 邮箱| 筠连县| 惠安县| 澄江县| 临湘市| 江都市| 阆中市| 铁力市| 界首市| 安远县| 哈密市| 长春市| 宁南县| 滨州市| 汪清县| 北流市| 大连市|