Github_headersdowncells_ title View drop-down sub cells

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.