Swift-page layout with tableview static cells

Source: Internet
Author: User

By using the list of static cells, we can easily make the page layout. The following is a demonstration using a "Add Task page".
as follows:

implementation steps:1, drag a tableviewcontroller into the storyboard and create a corresponding class (Mytabelviewcontroller.swift) to bind. 2, select table, set content to static cells,sections set to 2 in the Properties panel

3, select 1th sections, set rows to 1, and drag a textfiled into the cell

4, select 2ndSections, set rows to 2 to two cells and drag them into the corresponding label and switch controls
5,mytabelviewcontroller.swift
123456789101112131415161718192021222324252627 class MyTableViewController: UITableViewController {    override func viewDidLoad() {        super.viewDidLoad()              self.title = "添加任务"        //去除尾部多余的空行        self.tableView.tableFooterView = UIView(frame:CGRectZero)    }    override func didReceiveMemoryWarning() {        super.didReceiveMemoryWarning()    }    override func numberOfSectionsInTableView(tableView: UITableView) -> Int {        return 2    }    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {        if section == 0 {            return 1        }else{            return 2        }           } }

Swift-page layout with tableview static cells

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.