0
A
回答
1
看到這個漂亮的教程: Table View Animations and Gestures
演示瞭如何使用動畫更新來打開和查看,其中每個部分代表一個玩表視圖的閉部分,每一行都包含來自劇中報價。它還使用手勢識別器來響應用戶輸入:*一個UITapGestureRecognizer允許點擊節頭以擴展節; * UIPinchGestureRecognizer允許動態改變表格視圖行的高度; * UILongPressGestureRecognizer允許按住表格視圖單元以啓動報價電子郵件。
0
我遇到了類似的功能,全力打造成爲一個粗略的算法是:
實施uitableviewdelgate和uitableviewdatasource協議
創建一個全局變量expandedSectionIndex = -1;
= -1表示全部摺疊。
= 0表示expandedSectionIndex。
//the following protocol definitions will take care of which section is to be expanded. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if(expandedSectionIndex == section) return [self.dataArray[section] count]; else return 0; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { if(self.dataArray) return [self.dataArray count]; }
在定義自定義首部的觀點 - 的tableView:viewForHeaderInSection:具有幀等效
- 按鈕到頭視圖幀
- 設定按鈕標籤屬性與節號值。
將所有按鈕與選擇器關聯 - (void)展開:(id)sender;
- (void)expand:(id) sender { expandedSectionIndex = [sender tag]; [self.tableView reload]; }
相關問題
- 1. 創建可擴展的iOS視圖
- 2. 如何在ios中創建可展開的表格視圖?
- 3. joomla擴展創建表格
- 4. 如何創建可擴展列表?
- 5. 如何創建可擴展表單?
- 6. iPhone視窗和可擴展的圖像
- 7. 如何創建一個可擴展的表格
- 8. 可擴展列表視圖
- 9. 如何使用java腳本創建擴展列表視圖?
- 10. 我想創建按鈕單擊可擴展列表視圖
- 11. ASP.NET可擴展的網格視圖?
- 12. 如何在iPhone的表格視圖中創建複選標記?
- 13. 如何使用複選框創建可擴展列表視圖活動?
- 14. iPhone在另一個視圖之上的可擴展視圖
- 15. 帶表格的可擴展列表視圖
- 16. Android中的可擴展列表視圖
- 17. 可擴展的列表視圖問題
- 18. Android的可擴展列表視圖
- 19. scrollview內可擴展的列表視圖
- 20. iOS中的可擴展列表視圖
- 21. 可擴展的列表視圖android json
- 22. 如何創建可擴展的視圖,而不使用android中的任何庫
- 23. 如何創建擴展Android的視圖界面的項目?
- 24. 如何創建可擴展xml
- 25. 表格視圖單元格可擴展iOS
- 26. Odoo。如何創建擴展模型的視圖
- 27. 我可擴展的列表視圖不會擴展
- 28. 如何在擴展視圖的類中創建按鈕和圖像視圖?
- 29. 如何創建表格視圖?
- 30. Xcode iPhone - 在視圖內創建一個表格(不是表格)
這正是不是教程,只是一個示例代碼 – ilhnctn