Customizable custom UITableViews - really a way to implement standard forms on iOS?

What does that mean about

I notice that many of the applications I use have a similar way to implement forms (sets). For instance:

enter image description hereenter image description here

Basically, this is the same scheme as in the Settings application.

My problem

When I need to do something like this, I basically do a UITableView grouping, determine how many groups with the number of fields I have, etc. cellForRowAtIndexPath basically becomes a big switch operation that sets the accesoryView field to the correct form. I do all the form fields in advance in the code and make sure that they are configured correctly.

However, I have a feeling that there should be a much better way. This seems like a lot of duplicate code. And a code that is very difficult for me to do.

What I want

Ideally, I would just like to write my entire form from Interface Builder, because it is really intuitive for me. So, create the UITableView content and its contents in Interface Builder. Just making a form in IB is simple, of course, but not by placing the fields in a grouped view of the table - which I really want, because it looks pretty and consistent.

Another option is something like Settings Packages : I determine the type and name of my fields, the application code displays a table, creates instances of fields, etc.

I am looking for something better, because it seems strange to me that such an extremely common problem needs to be solved in such a complex way. Especially considering that many of the common problems have already been resolved well. But on this problem I can not find anything.

So: is my approach really the best way to display such forms? Can details be improved? Is there a way to ignore existing iOS libraries?

+4
source share
1 answer

A UITableView really the best way. You can use UIScrollView , but it will require a lot more work, since you will lose the built-in functions offered by UITableView .

If you prefer to use IB, which I fully understand, then you can create each UITableViewCell in IB, place it with objects, associate an IBOutlet , and then include it in your UITableView this way. It also makes it easy to set up actions and delegates for the objects you use, for example. UITextField and UISwitch es.

0
source

All Articles