IOS UI Basics 07

Source: Internet
Author: User

  • TableView

    • Property

         Set the height of each row of cells@property (nonatomic)CGFloat rowHeight;Set the height of each group of headers@property (nonatomic)CGFloat sectionheaderheight;Set the split Line color@property (Nonatomic, retain)Uicolor *separatorcolorSetting the header control@property (Nonatomic, retain)UIView *tableheaderview;Set footer controls@property (Nonatomic, retain)UIView *tablefooterview;2. High end of group head GroupSelf. TableView. Sectionheaderheight =35}self.tableview22; //3. Set the head/tail view of the entire Tablview self . Tableview.tableheaderview = [[Uiswitch alloc] init]; self.tableviewuibutton Buttonwithtype:uibuttontypeinfodark]; //4. Set our split Line color (Clearcolor equivalent to canceling the system split line) // Self.tableView.separatorColor = [Uicolor Clearcolor]; //5. Set the split line style self.tableView< Span class= "hljs-variable" >.separatorstyle = Uitableviewcellseparatorstylenone;       
    • Data source Methods
        How many groups are in the cell-(Nsinteger) Numberofsectionsintableview: (UITableView *) TableViewTell TableView how many lines are in section group-(Nsinteger) TableView: (UITableView *) TableView numberofrowsinsection: (Nsinteger) SectionTell TableView what each line shows (each line of TableView is UITableViewCell)-(UITableViewCell *) TableView: (UITableView *) TableView Cellforrowatindexpath: (Nsindexpath *) IndexpathTell TableView header text for section group-(NSString *) TableView: (UITableView *) TableView titleforheaderinsection: (Nsinteger) SectionTells TableView the trailing caption text of section Group-(NSString *) TableView: (uitableview *) TableView titleforfooterinsection: (nsinteger) Section// Returns the index title of each group-(Nsarray *) Sectionindextitlesfortableview: (uitableview *) TableView //Returns the height of each cell-(  CGFloat) TableView: (uitableview *) TableView Heightforrowatindexpath: (nsindexpath *) Indexpath//Delete data-( void) TableView: (uitableview *) TableView Commiteditingstyle: (uitableviewcelleditingstyle) Editingstyle Forrowatindexpath: (nsindexpath *) Indexpath; //
    • Proxy method
       As long as the implementation of this method, the left slide appears the function of the button (once the left slide appears n buttons, tableView into the editing mode, tableview.editing = YES)-(void) TableView: (UITableView *) TableView Commiteditingstyle: (uitableviewcelleditingstyle) Editingstyle Forrowatindexpath: (Nsindexpath *) IndexpathWhat button appears when left slide cell-(Nsarray *) TableView: (UITableView *) TableView Editactionsforrowatindexpath: (Nsindexpath *) Indexpath {uitableviewrowaction *action0 = [uitableviewrowaction rowactionwithstyle: Uitableviewrowactionstylenormal title:@ "Attention" handler:^ (uitableviewrowaction *action,Nsindexpath *indexpath) {NSLog (@ "Click on the Attention");Retract the left Slide button (Exit edit mode) TableView. editing =NO; }]; Uitableviewrowaction *action1 = [uitableviewrowaction rowactionwithstyle:uitableviewrowactionstyledefault title:@ "Delete" handler:^ (uitableviewrowaction *action, nsindexpath *indexpath) {[self. Winearray Removeobjectatindex:indexpath. row]; [TableView Deleterowsatindexpaths:@[indexpath] withrowanimation:uitableviewrowanimationautomatic]; }]; return @[action1, Action0];} //Agent method to get a bit of selected line, line number-(void) TableView: (uitableview *) TableView Didselectrowatindexpath: (Nsindexpath *) Indexpath; //Allow editing of selected lines-(BOOL) TableView: (uitableview *) TableView Caneditrowatindexpath: (Nsindexpath *) Indexpath;             
  • UITableViewCell

      • Property:
         //set the indicator style to the right of the cell / /accessoryview priority > Accessorytype//cell.accessoryview = [[Uiswitch alloc] Init]; @property (nonatomic) Uitableviewcellaccessorytype AccessoryType; //default is Uitableviewcellaccessorynone. Use to set standard type    
      • Cell creation

        • Register create

           [self.tableview registerclass:[uitableviewcell class] Forcellreuseidentifier:id]; //registration can be directly from the cache to find the creation of uitableviewcell *cell = [TableView Dequeuereusablecellwithidentifier:id];       
        • Unregistered create

          • Find first from cache hold

              uitableviewcell *cell=[tableview Dequeuereusablecellwithidentifier:id];   
          • Not found in Create

              if (nil== Cell) {Cell=[[uitableviewcell alloc]initwithstyle:uitableviewcellstylesubtitle Reuseidentifier:id]; }

IOS UI Basics

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.