2015-08-26 4 views
8

में ट्री स्ट्रक्चर जैसे विस्तारणीय तालिका दृश्य कैसे बनाएं, हाय, मुझे अपने डेटा के लिए विस्तारणीय तालिका दृश्य की आवश्यकता है, क्या यह तालिका दृश्य में इस तरह बनाना संभव है। मेरे डेटा में प्रत्येक के पास अलग-अलग बच्चे हैं, नीचे मेरा है डेटाआईओएस

-A1 
    -A1.1 
     -A1.1.1 
      A1.1.1.1 
+B1 
+C1 
+D1 

---------------------- 
+A1 
-B1 
    +B1.1 
+C1 
+D1 
----------------------- 
+A1 
+B1 
+C1 
-D1 
    +D1.1 
    -D1.2 
     +D1.2.1 
     +D1.2.2 
    +D1.3 

सहायता मुझे अग्रिम धन्यवाद

उत्तर

12

अपने प्रश्न बहुत बड़ा है, तो उत्तर सबमिट निम्न लिंक

  1. कोशिश

  2. MultiLevel UITableView – Expandable & Collapsable UITableView

  3. KOTree

  4. TQMultistageTableView

  5. UITreeView
+0

अपने त्वरित जवाब के लिए धन्यवाद पर UITreeView उदाहरण नहीं है, इन उदाहरणों अच्छा धन्यवाद कर रहे हैं आप – Test

+0

यह भी मुझे https प्राप्त होता है://github.com/TinyQ/TQMultistageTableView – Test

+0

ठीक है मैं इस लिंक को भी जोड़ता हूं, खोज के लिए धन्यवाद .... –

2

इस कोशिश: -

NSMutableIndexSet *expandedSections; 
    @property (strong, nonatomic) NSIndexPath *expandedIndexPath; 



- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 
    { 

    if ([indexPath compare:self.expandedIndexPath] == NSOrderedSame) { 
     return 100; 
    } 
    else 
    { 
    return 30; 
    } 

} 


    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
    { 

    [tableView deselectRowAtIndexPath:indexPath animated:YES]; 
    if ([indexPath compare:self.expandedIndexPath] == NSOrderedSame) { 
     [tableView beginUpdates]; 
     self.expandedIndexPath = nil; 
     [tableView endUpdates]; 
    } 
    else{ 
     self.expandedIndexPath = [NSIndexPath indexPathForRow:indexPath.row inSection:indexPath.section]; 

     [tableView beginUpdates]; 

    if ([indexPath compare:self.expandedIndexPath] == NSOrderedSame)  { 
     self.expandedIndexPath = indexPath; 
    } else { 
     self.expandedIndexPath = nil; 
    } 

    [tableView endUpdates]; 
    } 

} 
1

GitHub UITreeView

+0

आपको बहुत धन्यवाद @ वीरुन, UITreeView सही विकल्प है – swiftBoy