Summarize the knowledge points of TableView
Creation of 1.tableView
//creation of TableView//1. InitializeUITableView *tableview =[[UITableView alloc] InitWithFrame:self.view.frame Style:uitableviewstyleplain]; //2. Set properties (row height, split line, header, footer)Tableview.rowheight = -; //uitableviewcellseparatorstylesingleline (default)Tableview.separatorstyle =Uitableviewcellseparatorstylesingleline; Tableview.separatorcolor=[Uicolor Redcolor]; Tableview.separatorinset= Uiedgeinsetsmake (0,0,0,0); Tableview.backgroundcolor=[Uicolor Graycolor]; UILabel*headerlabel = [[UILabel alloc] Initwithframe:cgrectmake (0,0,375, -)]; Headerlabel.text=@"iOS Apps leaderboard"; Headerlabel.textalignment=Nstextalignmentcenter; Tableview.tableheaderview= Headerlabel;//table header, you need to create a label and then assign the created label to the footer of the header[Headerlabel release]; //redundant split lines can be cleared through the footer//Tableview.tablefooterview = [[[UIView alloc] init] autorelease]; //set whether to allow multiple selectionsTableview.allowsmultipleselection =YES; //3. Add Parent View[Self.view Addsubview:tableview]; //4. Release[TableView release];
Creation of TableView