2011-03-04 11 views
16
विस्तृत

संभव डुप्लिकेट:
UITableView Cell expand on clickपतन UITableViewCell

मैं UITableView.My आवश्यकता के UITableViewCell में मदद की जरूरत है नीचे है:

enter image description here

रीट्वीट पर नज़र, सूची और अधिक जब मैं प्रतीत होता है enter image description here

आप देख सकते हैं कि रीटविट विस्तार और अन्य लिस्टिंग और सूची और नीचे दिखाए गए स्लाइड को दिखाता है। मैं इसे बनाना चाहता हूं। किसी भी प्रकार की सहायता की अत्यधिक सराहना की जाती है, ट्यूटोरियल लिंक या कुछ भी। धन्यवाद

उत्तर

20

आप एप्पल से उपयोगी, this नमूना कोड भी पा सकते हैं।

+0

मैंने आपके चेकआउट को चेकआउट किया है लिंक, हां यह लगभग वही है जो मैं चाहता था, लेकिन यह एक बड़ा कार्यक्रम है, इसलिए यदि मैं कुछ भी नहीं मिला, तो मैं वैकल्पिक रूप से खोज रहा हूं, निश्चित रूप से आपके विचार के साथ जाऊंगा। बहुत बहुत धन्यवाद, वास्तव में इसकी सराहना करते हैं –

+0

@ क्षित्य आप कस्टम कोशिकाओं का आसानी से उपयोग करके कार्यक्षमता भी प्राप्त कर सकते हैं, लेकिन मेरा अनुभव कहता है कि इस विधि से आपको जो आसान अनुभव मिलेगा वह उस तक प्राप्त नहीं होगा। – Vin

+0

ने कहा कि खाते में, एक बार फिर से धन्यवाद –

2

यदि आप एक ऐप्पल डेवलपर हैं, तो डब्ल्यूडब्ल्यूडीसी वीडियो पर जाएं और उन्नत टेबल व्यू वीडियो देखें। यह वर्णन करता है कि आप वास्तव में क्या करना चाहते हैं।

+0

क्या आप मुझे लिंक दे सकते हैं। हां, मैं सेब डेवलपर हूं –

+1

http://developer.apple.com/itunes/?destination=adc.apple.com.4092414566 एक बार जब आप अंदर हों, तो एप्लिकेशन फ्रेमवर्क पर जाएं और फिर वीडियो 28 पर जाएं, मास्टरिंग टेबल व्यू – Jamie

8

मैंने टेबलव्यू हेडर का उपयोग करके एक ही लागू किया है।

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { 
    UIView *customView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 32)]; 
    UIButton *sectionButton = [UIButton buttonWithType:UIButtonTypeCustom]; 
    sectionButton.tag = section; 
    sectionButton.frame = customView.frame; 
    [sectionButton addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside]; 

    UILabel *titleLabel = [[[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 32)] autorelease]; 
    titleLabel.textAlignment = UITextAlignmentCenter; 
    titleLabel.backgroundColor = [UIColor clearColor]; 
    titleLabel.font = [UIFont boldSystemFontOfSize:13]; 
    titleLabel.textColor = [UIColor whiteColor]; 

    NSString *tableHeader = @"table_header_down.png"; 
    switch (section) { 
     case 0: 
      titleLabel.text = @"Section1"; 
      tableHeader = showSection1 ? @"table_header_up.png" : @"table_header_down.png"; 
      break; 
     case 1: 
      titleLabel.text = @"Section2"; 
      tableHeader = showSection2 ? @"table_header_up.png" : @"table_header_down.png"; 
      break; 
     case 2: 
      titleLabel.text = @"Section3"; 
      tableHeader = showSection3 ? @"table_header_up.png" : @"table_header_down.png"; 
      break; 
     case 3: 
      titleLabel.text = @"Section4"; 
      tableHeader = showSection4 ? @"table_header_up.png" : @"table_header_down.png"; 
      break; 
     default: 
      break; 
    } 
    [sectionButton setImage:[UIImage imageNamed:tableHeader] forState:UIControlStateNormal]; 
    [customView addSubview:sectionButton]; 

    [customView addSubview:titleLabel]; 

    return [customView autorelease]; 
} 

तब मैं प्रत्येक अनुभाग के लिए इसी बूलियन मूल्यों को तदनुसार सेल भरी हुई, पंक्तियों की संख्या अगर बूल 0, और गिनती लौटाता है जब बूल 1.

+0

ले रहा है, लेकिन मुझे देर हो जाएगी कल निश्चित रूप से अपना समाधान देखें, thanx –

+0

भी, मैं एक बात का उल्लेख करना भूल जाता हूं, यदि अनुभाग विधि में पंक्तियों में आपको संख्या में कुछ और करने की आवश्यकता हो सकती है। शून्य लौटाएं, अगर उस खंड से संबंधित बूलियन चर शून्य है। बटन दबाए गए तरीके में, मैं 0 और 1. – Nithin

1

मैंने सोचा this applelink आप में मदद करता है यह रिटर्न 0 टेबल व्यू का शानदार उदाहरण

+0

के बीच अनुभाग का ध्वज बदल रहा हूं, आपका लिंक और विन का लिंक वही है, वैसे भी thanx –

+0

[HVTableView] (https://github.com/xerxes235/HVTableView): UITableView विस्तार/पतन सुविधा के साथ –