Section Footer Add button for IOS UITableView

Source: Internet
Author: User

Shimen the main contribution, respect the work of the author, please do not reprint.

If the article is helpful to you, you are welcome to donate to the author, support the Shimen, donate the amount at random, ^_^

I want to donate: Click Donate

Cocos2d-x source Download: Dot I teleport


When working with the UITableView table, we want to add a button at the bottom of the view.

The button can follow the move when the user drags UITableView .

Title, implement the following interface:


-(CGFloat) TableView: (UITableView *) TableView heightforfooterinsection: (Nsinteger) section{if (section >=    ksetsetting) {return 80;    } else{return 2; }}-(UIView *) TableView: (UITableView *) TableView viewforfooterinsection: (Nsinteger) section{if (section >= Ksetsett        ing) {UIView *footerview = [[UIView alloc] init];        footerview.userinteractionenabled = YES;                Footerview.backgroundcolor = [Uicolor Clearcolor];        UIButton *loginbutton = [UIButton Buttonwithtype:uibuttontypesystem];        [Loginbutton.layer Setmaskstobounds:yes];        [Loginbutton.layer setcornerradius:5.0];        [Loginbutton Setbackgroundcolor:[uicolor Browncolor];        [Loginbutton settitle:@ "Landing" forstate:uicontrolstatenormal];        [Loginbutton Settitlecolor:[uicolor Whitecolor] forstate:uicontrolstatenormal];        [Loginbutton.titlelabel Setfont:[uifont systemfontofsize:15]; [Loginbutton settranslatesautoresizingmaskintoconstraints:NO];        [Loginbutton addtarget:self Action: @selector (Loginbtnclick:) forcontrolevents:uicontroleventtouchupinside];                [Footerview Addsubview:btnexit];                [Footerview Addsubview:loginbutton];        UIButton *registerbutton = [UIButton Buttonwithtype:uibuttontypesystem];        [Registerbutton.layer Setmaskstobounds:yes];        [Registerbutton.layer setcornerradius:5.0];        [Registerbutton Setbackgroundcolor:[uicolor Browncolor];        [Registerbutton settitle:@ "registration" forstate:uicontrolstatenormal];        [Registerbutton Settitlecolor:[uicolor Whitecolor] forstate:uicontrolstatenormal];        [Registerbutton.titlelabel Setfont:[uifont systemfontofsize:15];        [Registerbutton Settranslatesautoresizingmaskintoconstraints:no];        [Registerbutton addtarget:self Action: @selector (Registerbtnclick:) forcontrolevents:uicontroleventtouchupinside];                [Footerview Addsubview:registerbutton]; Nsdictionary *constraintsview = nsdictionAryofvariablebindings (Loginbutton,registerbutton);  [Footerview addconstraints:[nslayoutconstraint constraintswithvisualformat:@ "v:|-15-[loginbutton]-15-|"        options:0 Metrics:nil Views:constraintsview]]; [Footerview addconstraints:[nslayoutconstraint constraintswithvisualformat:@ "|-20-[loginbutton]" options:0 metrics                : Nil Views:constraintsview]]; [Footerview addconstraints:[nslayoutconstraint constraintswithvisualformat:@ "V:|-15-[registerbutton (= =  Loginbutton)]-15-| "        options:0 Metrics:nil Views:constraintsview]]; [Footerview addconstraints:[nslayoutconstraint constraintswithvisualformat:@ "H:[loginbutton]-30-[registerbutton (    ==loginbutton)]-20-| "                options:0 Metrics:nil Views:constraintsview]];    return footerview;    } else {return nil; }}

Shimen the main contribution, respect the work of the author, please do not reprint.

If the article is helpful to you, you are welcome to donate to the author, support the Shimen, donate the amount at random, ^_^

I want to donate: Click Donate

Cocos2d-x source Download: Dot I teleport

Section Footer Add button for IOS UITableView

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.