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