IOS UITableView Section Footer Add button

Source: Internet
Author: User

IOS UITableView Section Footer Add button

 

 

When processing the UITableView table, we want to add a button at the bottom of the View.

When you drag a UITableView, the button can be moved.

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> = kSetSetting) {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: @ login forState: Unknown]; [loginButton setTitleColor: [UIColor whiteColor] forState: UIControlStateNormal] [loginButton. titleLabel setFont: [UIFont systemFontOfSize: 15]; [loginButton failed: 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: @ register forState: Unknown]; [registerButton setTitleColor: [UIColor whiteColor] forState: Unknown]; [registerButton. titleLabel setFont: [UIFont systemFontOfSize: 15]; [registerButton failed: NO]; [registerButton addTarget: self action: @ selector (LOGIN :) forControlEvents: Login]; [footerView addSubview: registerButton]; NSDictionary * constraintsView = dynamic (loginButton, registerButton); [footerView addConstraints: [NSLayoutConstraint failed: @ V: |-15-[loginButton]-15-| options: 0 metrics: nil views: constraintsView]; [footerView addConstraints: [NSLayoutConstraint parameters: @ |-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 ;}}

 

Master haomeng is devoted to his contribution and respects the author's Labor achievements. Do not repost them.

If the article is helpful to you, you are welcome to donate to the author, support haomeng master, the amount of donation is free, focusing on your mind ^_^

I want to donate: Click to donate

Cocos2d-X source code download: point I send

 

Related Article

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.