Title View drop-down sub cells, you can customize the content and number of Title view, sub-cell, and will continue to optimize recently
Https://github.com/alwaysDB/HeadersDownCells.git
Here are some of the code
1- (void) Groupheaderviewdidclickbtngrouptitle: (Babysettingheaderview *) Groupheaderview {2 //[Self.tableview Reloaddata];3 //Ddlog (@ "Groupheaderview.tag%ld", Groupheaderview.tag);4Nsindexset *idxset =[Nsindexset IndexSetWithIndex:groupHeaderView.tag];5 [Self.tableview reloadsections:idxset withrowanimation:uitableviewrowanimationnone];6 }7 8-(Nsinteger) Numberofsectionsintableview: (UITableView *) TableView {9 returnSelf.groups.count;Ten } One A-(Nsinteger) TableView: (UITableView *) TableView numberofrowsinsection: (nsinteger) Section { - //get the current group model -Headergroup *group =Self.groups[section]; the if(group.isvisible) { - returnGroup.cellnum; - } - return 0; + } - +-(CGFloat) TableView: (UITableView *) TableView Heightforrowatindexpath: (Nsindexpath *) Indexpath { A Switch(indexpath.section) { at Case 0: - return the; - Case 1: - return -; - Case 2: - return the; in Break; - to default: + return -; - Break; the } * } $ Panax Notoginseng-(UITableViewCell *) TableView: (UITableView *) TableView Cellforrowatindexpath: (Nsindexpath *) Indexpath { - StaticNSString *cellid =@"Babycarecell"; theUITableViewCell *babycell =[TableView dequeuereusablecellwithidentifier:cellid]; + if(Babycell = =Nil) { ABabycell =[[UITableViewCell alloc] Initwithstyle:uitableviewcellstyledefault reuseidentifier:cellid]; the } + for(UIView *viewinchbabyCell.contentView.subviews) { - [view Removefromsuperview]; $ } $ -Babycell.selectionstyle =Uitableviewcellselectionstylenone; - the Switch(indexpath.section) { - Case 0:Wuyi [Babycell.contentview AddSubview:self.datePicker]; the - [Babycell.contentview addSubview:self.dateSureBtn]; Wu //[Babycell.contentview bringSubviewToFront:self.dateSureBtn]; -NSLog (@"datesurebtn%@", Nsstringfromcgrect (Self.dateSureBtn.frame)); About $Self.datePicker.datePickerMode =uidatepickermodedate; - returnBabycell; - Break; - Case 1: A [Babycell.contentview AddSubview:self.textView]; + returnBabycell; the Break; - Case 2: $ [Babycell.contentview AddSubview:self.textField]; theSelf.textField.borderStyle =Uitextborderstyleroundedrect; the returnBabycell; the Break; the default: - returnBabycell; in Break; the } the } About the-(UIView *) TableView: (UITableView *) TableView viewforheaderinsection: (nsinteger) Section { theHeadergroup *group =Self.groups[section]; theBabysettingheaderview *headerview =[Babysettingheaderview Headerviewwithtableview:tableview]; +Headerview.tag =Section ; -Headerview.group =Group; theHeaderview.Delegate=Self ;BayiHeaderView.headerTitleLabel.text =Nil; the theCGFloat RightMargin = -; -CGFloat onlinew = Max; -CGFloat Onlineh = -; theCGFloat Onliney =0; theCGFloat Onlinex = Screan_width-rightmargin-onlinew; the the Switch(section) { - Case 0: theHeaderView.headerTitleLabel.text =self.titleheaderstr1; the theSelf.dateLab.frame =CGRectMake (Onlinex, Onliney, Onlinew, Onlineh);94Self.dateLab.textAlignment =Nstextalignmentright; the the [Headerview.contentview AddSubview:self.dateLab]; the 98 returnHeaderview; About Case 1: -HeaderView.headerTitleLabel.text =self.titleheaderstr2;101 102Self.reasonLab.frame =CGRectMake (Onlinex, Onliney, Onlinew, Onlineh);103Self.reasonLab.textAlignment =Nstextalignmentright;104 the [Headerview.contentview AddSubview:self.reasonLab];106 returnHeaderview;107 Case 2:108HeaderView.headerTitleLabel.text =SELF.TITLEHEADERSTR3;109 theSelf.numberLab.frame =CGRectMake (Onlinex, Onliney, Onlinew, Onlineh);111Self.numberLab.textAlignment =Nstextalignmentright; the 113 [Headerview.contentview AddSubview:self.numberLab]; the returnHeaderview; the Break; the 117 default:118 returnHeaderview;119 Break; - }121 }122 123-(CGFloat) TableView: (UITableView *) TableView heightforheaderinsection: (nsinteger) Section {124 return -; the}
Github_headersdowncells_ title View drop-down sub cells