简体   繁体   中英

iOS static table in a view?

Sorry if this is a really silly question but I'm new to iOS. I'm trying to do this:

在此输入图像描述

The table cells are static as the content shouldn't change (the options are the same all the time). I also need to place the submit and cancel buttons below and replace the red background with an image.

My problem is, I get the error saying:

static table views are only valid when embedded in uitableviewcontroller

So my question is, how would I embed a table inside my view, like any other element?

Thanks in advance for any help :)

There are two relatively simple options to build a screen like that:

  1. Make your controller a `UITableViewController, add two sections to the bottom of your static part, and put custom cells with buttons into these two sections, or
  2. Define the static content of your table in code.

The look of your screen will change slightly for option 1, but it is important only when you have many cells, forcing the sections with buttons off the screen until the user scrolls.

The second option requires writing some code, but not too much to cause you too much inconvenience.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM