iOS Seventh day (display of 4:uitableview data optimizes repeat instances and Tablefooterview and Tableheaderview)

Source: Internet
Author: User

Plus head and bottom

- (void) viewdidload{[Super Viewdidload];        [Self tableView]; //Set Row HeightSelf.tableView.rowHeight = -; //Divider LineSelf.tableView.separatorStyle =Uitableviewcellseparatorstylesingleline; /** 32-bit True Color ARGB 2^8 * 2^8 * 2^8 * 2^8 = 2^32 = 2^2 * 2^10 * 2^10 * 2^10 = 4G 2^64 = GG A = Alpha R G B 24 bit True Color RGB 2^8 * 2^8 * 2^8 = 2 ^ 24 = 2^4 * 2^10 = 16 * 1 million R = Red 1 bytes 8 bit 0~255 G = Gr Een B = blun # FF FF FF*/Self.tableView.separatorColor= [Uicolor colorwithwhite:0.0Alpha0.2]; //Headview, placed at the top of the TableView view, usually used to place the picture carouselUIView *head = [[UIView alloc] Initwithframe:cgrectmake (0,0, the, the)]; Head.backgroundcolor=[Uicolor Bluecolor]; Self.tableView.tableHeaderView=Head; //Footerview, usually do pull-up refreshUIView *foot = [[UIView alloc] Initwithframe:cgrectmake (0,0, the, -)]; Foot.backgroundcolor=[Uicolor Redcolor]; Self.tableView.tableFooterView=Foot;}

Optimizing cell multiplexing View

 //0. Reusable identifier string//static variable to ensure that the system allocates only one memory space for the variable in memory//static variables, once created, will not be released and will only be released if the application is destroyed!     StaticNSString *id =@"Cell"; //1. Take the cache pool to find reusable cellsUITableViewCell *cell =[TableView Dequeuereusablecellwithidentifier:id]; //2. If you do not find    if(Cell = =Nil) {NSLog (@"Instantiating cells"); //Create a cell, and set the properties of the cell that have commonality//instantiate a new cellCell =[[UITableViewCell alloc] Initwithstyle:uitableviewcellstylesubtitle Reuseidentifier:id]; //RIGHT ARROWCell.accessorytype =Uitableviewcellaccessorydisclosureindicator; //background color, which affects the label background for unselected table rows//Cell.backgroundcolor = [Uicolor Redcolor]; //in actual development, the use of background views is more//background view, does not need to specify the size, the cell will automatically fill the display of the background view according to its own size//UIImage *bgimage = [UIImage imagenamed:@ "img_01"];//Cell.backgroundview = [[Uiimageview alloc] initwithimage:bgimage];//UIView *bgview = [[UIView alloc] init];//Bgview.backgroundcolor = [Uicolor yellowcolor];//Cell.backgroundview = Bgview; //no background color selected//the selected background view//UIImage *selectedbgimage = [UIImage imagenamed:@ "img_02"];//Cell.selectedbackgroundview = [[Uiimageview alloc] initwithimage:selectedbgimage];}

iOS Seventh day (display of 4:uitableview data optimizes repeat instances and Tablefooterview and Tableheaderview)

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.