IPhone Design Question for iPhone - the best way to design forms?

I want to create an application that requires the user to enter several elements such as start date, end date, many other parameters and some text comments, for which I plan to use collectors to select data that will slide up the models. I will need to move the view up and down to make sure the fillable element remains in focus when the pickers and keyboard slide up and down.

My question is, what would be the best look at implementing such a “form”? I was thinking of a grouped table view where I could split the field section wise.

Is there any other way to implement these things? From experience or best practice, are there any better alternatives or sample code or applications that I can research?

Dev.

+3
source share
1 answer

The most iPhone-like interface for forms will be a grouped view of the table. This is what most users expect after using other applications that use grouped table views to add and edit structured data.

It is good practice to create enum(enumerate) for sections and for lines within sections, for example:

typedef enum {
    kFormSectionFirstSection = 0,
    kFormSectionSecondSection,
    kFormSectionThirdSection,
    kFormSections
} FormSection;

typedef enum {
    kFormFirstSectionFirstRow = 0,
    kFormFirstSectionSecondRow,
    kFormFirstSectionRows
} FormFirstSectionRow;

...

.

( , , kFormSectionFirstSection , - kFormSectionNameFieldSection kFormSectionAddressFieldSection .., , , enum.)

?

, , :

- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
    return kFormSections;
}

- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    switch (section) {
        case kFormSectionFirstSection:
            return kFormFirstSectionRows;

        case kFormSectionSectionSection:
            return kFormSecondSectionRows;

        ...

        default:
            break;
    }
    return -1;
}

- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    // cell setup or dequeue...

    switch (indexPath.section) {
        case kFormSectionThirdSection: { 
            switch (indexPath.row) {
                case kFormThirdSectionFourthRow: {

                    // do something special here with configuring 
                    // the cell in the third section and fourth row...

                    break;
                }

                default:
                    break;
            }
        }

        default:
            break;
    }

    return cell;
}

.

, . , , .

, , , enum. , , .

+7

Source: https://habr.com/ru/post/1755825/


All Articles