Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

enter image description here

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 :)

like image 337
David Omid Avatar asked Mar 26 '26 20:03

David Omid


1 Answers

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.

like image 136
Sergey Kalinichenko Avatar answered Mar 28 '26 10:03

Sergey Kalinichenko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!