मैंने टेबलव्यू हेडर का उपयोग करके एक ही लागू किया है।
- (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.
मैंने आपके चेकआउट को चेकआउट किया है लिंक, हां यह लगभग वही है जो मैं चाहता था, लेकिन यह एक बड़ा कार्यक्रम है, इसलिए यदि मैं कुछ भी नहीं मिला, तो मैं वैकल्पिक रूप से खोज रहा हूं, निश्चित रूप से आपके विचार के साथ जाऊंगा। बहुत बहुत धन्यवाद, वास्तव में इसकी सराहना करते हैं –
@ क्षित्य आप कस्टम कोशिकाओं का आसानी से उपयोग करके कार्यक्षमता भी प्राप्त कर सकते हैं, लेकिन मेरा अनुभव कहता है कि इस विधि से आपको जो आसान अनुभव मिलेगा वह उस तक प्राप्त नहीं होगा। – Vin
ने कहा कि खाते में, एक बार फिर से धन्यवाद –