iOS Uitableview,uitableviewheaderfooterview packet Head reuse mechanism, simple affine transform Cgaffinetransform

Source: Internet
Author: User

How to set a section of the same height including the first column (small tricks, although easy but easy to ignore)

* First step, set tail to 0,table.sectionfooterheight = 0 in Viewdidload, (proxy method)-(CGFloat) TableView: (UITableView *) TableView Heightforfooterinsection: (Nsinteger) section{

return 0;

Although you can also set the tail height, there is no effect after setting

In the second step, call TableView's Proxy Method-(CGFloat) TableView: (UITableView *) TableView heightforheaderinsection: (Nsinteger) section{

return 30;

} Set the head height to 30;

Run results


Custom packet header reuse (similar to cell)

If you customize the group header

For memory optimization, you can use a cell-like reuse mechanism to implement


#pragma mark-Custom group header

-(UIView *) TableView: (UITableView *) TableView viewforheaderinsection: (Nsinteger) section{

Static NSString * Identy = @ "Headfoot";

Uitableviewheaderfooterview * HF = [TableView dequeuereusableheaderfooterviewwithidentifier:identy];

if (!HF) {

NSLog (@ "%li", section);

HF = [[Uitableviewheaderfooterview alloc]initwithreuseidentifier:identy];

UIView * view = [[UIView alloc]initwithframe:cgrectmake (0, 0, Self.view.frame.size.width, 44)];

View.backgroundcolor = [Uicolor Redcolor];

[HF Addsubview:view]; (If you add this comment: view is not added)

}

Hf.contentView.backgroundColor = [Uicolor purplecolor]; (Remove this line comment: The HF can be set.) Contentview background color), if this line and the previous line are not annotated, the red

return HF;

}


Affine transformations

-(void) clickaction{

Affine transformations

[UIView animatewithduration:0.5 animations:^{

Execute once

Self.rectView.transform = cgaffinetransformmaketranslation (100, 100);

Continue on the basis of Self.rectView.transform's current

Self.rectView.transform = Cgaffinetransformtranslate (self.rectView.transform, 100, 100);

//    }];

//

Affine proportions

[UIView animatewithduration:0.5 animations:^{

Execute once

Self.rectView.transform = Cgaffinetransformmakescale (5, 0.5);

Continue on the basis of Self.rectView.transform's current

Self.rectView.transform = Cgaffinetransformscale (Self.rectView.transform, 2, 2);

Self.rectView.transform = cgaffinetransformmaketranslation (100, 100);

//

//    }];

Affine rotation

[UIView animatewithduration:0.5 animations:^{

100 degrees

CGFloat degree100 = 100/180.0*M_PI;

CGFloat degree45 = m_pi_4;

Execute once

Self.rectView.transform = Cgaffinetransformmakerotation (m_pi_4);

Continue on the basis of Self.rectView.transform's current

Self.rectView.transform = Cgaffinetransformrotate (Self.rectView.transform, degree100);


}];

}


iOS Uitableview,uitableviewheaderfooterview packet Head reuse mechanism, simple affine transform Cgaffinetransformios UITableView, Uitableviewheaderfooterview the reuse mechanism of packet head, simply affine transform Cgaffinetransformios UITableView, Uitableviewheaderfooterview the reuse mechanism of packet head, and simply affine transform Cgaffinetransform

iOS Uitableview,uitableviewheaderfooterview packet Head reuse mechanism, simple affine transform Cgaffinetransform

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.