Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9189993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:21:38+00:00 2026-06-17T20:21:38+00:00

I have to render dynamic form in iPhone application using tableview. This form may

  • 0

I have to render dynamic form in iPhone application using tableview. This form may have multiple UI controls as button,textfield,lable, picker,date picker .

I got one sample code for iPad which is able to render the dynamic form,but this sample code is using UIPopoverController, which is not supported by iPhone application.
So I am looking for some sample code which should work in iPhone.

Below is the code which shows combo box on clicking the button in dynamic form. I need the code which should show picker with list items.

sample code: https://github.com/ecrichlow/iPad-Dynamic-Table-Cells

- (IBAction)buttonPressed:(id)sender
{

    [delegate rowItemWasSelected:self];
    if (self.itemControlType == ControlTypeToggleButton)
        {
        ...
        }
    else if (self.itemControlType == ControlTypePopup)
        {
        ...
        }
    else if (self.itemControlType == ControlTypeCombo)
        {
        UITableViewController *popoverTable = [[[UITableViewController alloc] initWithStyle:UITableViewStylePlain] autorelease];
        UIToolbar *toolbar = [[[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, DEFAULT_POPOVER_WIDTH, DEFAULT_TOOLBAR_HEIGHT)] autorelease];
        UIView *containerView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, DEFAULT_POPOVER_WIDTH, ([self.controlSelections count] * popoverTable.tableView.rowHeight) + DEFAULT_TOOLBAR_HEIGHT)] autorelease];
        UIViewController *containerViewController = [[[UIViewController alloc] init] autorelease];
        UIPopoverController *popoverController = [[UIPopoverController alloc] initWithContentViewController:containerViewController];
        UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(DEFAULT_COMBO_TEXTFIELD_MARGIN, (DEFAULT_TOOLBAR_HEIGHT - DEFAULT_COMBO_TEXTFIELD_HEIGHT) / 2, DEFAULT_POPOVER_WIDTH - (DEFAULT_COMBO_TEXTFIELD_MARGIN * 2), DEFAULT_COMBO_TEXTFIELD_HEIGHT)];
        textField.delegate = self;
        textField.autocorrectionType = UITextAutocorrectionTypeNo;
        textField.autocapitalizationType = UITextAutocapitalizationTypeNone;
        textField.font = [UIFont systemFontOfSize:DEFAULT_COMBO_FONT_SIZE];
        textField.borderStyle = UITextBorderStyleRoundedRect;
        textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
        [textField addTarget:self action:@selector(fieldTextDidUpdate:) forControlEvents:UIControlEventEditingDidEnd];
        containerViewController.view = containerView;
        popoverTable.tableView.dataSource = self;
        popoverTable.tableView.delegate = self;
        popoverTable.tableView.frame = CGRectMake(0, DEFAULT_TOOLBAR_HEIGHT, DEFAULT_POPOVER_WIDTH, [self.controlSelections count] * popoverTable.tableView.rowHeight);
        popoverController.popoverContentSize = CGSizeMake(DEFAULT_POPOVER_WIDTH, ([self.controlSelections count] * popoverTable.tableView.rowHeight) + DEFAULT_TOOLBAR_HEIGHT);
        popoverController.delegate = self;
        [toolbar addSubview:textField];
        [containerView addSubview:toolbar];
        [containerView addSubview:popoverTable.tableView];
        optionPopoverController = popoverController;
        [popoverController presentPopoverFromRect:control.frame inView:control.superview permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
        // If there's currently an object that's first responder, make it resign that status
        for (UIView *subview in self.control.superview.subviews)
            {
            if ([subview isKindOfClass:[UITextField class]])
                {
                if ([subview isFirstResponder])
                    {
                    [subview resignFirstResponder];
                    [[NSRunLoop mainRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1]];
                    }
                }
            }
        [textField becomeFirstResponder];
        }
    else if (self.itemControlType == ControlTypeButton)
        {
        // Don't need to do anything here. Caller passed in target and action. But in order to trigger delegate rowItemWasSelected this control type was added here.
        }

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T20:21:39+00:00Added an answer on June 17, 2026 at 8:21 pm

    You can modify the sample code iPad-Dynamic-Table-Cells for rendering dynamic form in iPhone along with with popover display also

    Add the below 6 files of project available on git-hub https://github.com/50pixels/FPPopover to your iPad-Dynamic-Table-Cells sample code

    FPPopoverController.h/.m, FPPopoverView.h/m, and FPTouchView.h/.m

    Now modify the FPTouchView.m, EditableTableDataRowItem.h and EditableTableDataRowItem.m as below

    //In EditableTableDataRowItem.h
    @interface EditableTableDataRowItem : UIViewController <UITableViewDataSource, UITableViewDelegate, UIPopoverControllerDelegate, UITextFieldDelegate,FPPopoverControllerDelegate>
    {
    
        id<EditableTableDataRowItemDelegate> delegate;
    
        RowItemControlType          itemControlType;        // So named to denote that this does not correspond to a UIControl
        NSArray                     *controlSelections;     // List of items to display for popup control type
        NSString                    *listKey;               // If controlSelections array contains NSManagedObjects or NSDictionaries, the key to use to get a string to represent the item
        CGSize                      baseSize;               // Default size of the control, with width relative to other items on the row
        BOOL                        resizeable;             // Determines whether item can be resized based on row width
        UIControl                   *control;               // Standard control particular to the type of row item
        UIImage                     *normalImage;           // Used to customize the appearance of any button-based control type
        UIImage                     *selectedImage;         // Used to customize the appearance of any button-based control type
    
        CGSize                      originalBaseSize;
        int                         state;
        int                         selectedIndex;
        UIPopoverController         *optionPopoverController;
        FPPopoverController *popover;
        id<FPPopoverControllerDelegate> delegate1;
    }
    @property(assign) id<EditableTableDataRowItemDelegate> delegate;
    @property(assign) id<FPPopoverControllerDelegate> delegate1;
    @property(nonatomic, retain) FPPopoverController *popover;
            .
            .
    

    //In EditableTableDataRowItem.m

    - (IBAction)buttonPressed:(id)sender
    {
        [delegate rowItemWasSelected:self];
        if (self.itemControlType == ControlTypeToggleButton)
            {
            .
            .
            .
    
            }
        else if (self.itemControlType == ControlTypePopup)
            {
            UITableViewController *popoverTable = [[[UITableViewController alloc] initWithStyle:UITableViewStylePlain] autorelease];
            popoverTable.tableView.dataSource = self;
            popoverTable.tableView.delegate = self;
            popover = [[FPPopoverController alloc] initWithViewController:popoverTable];
    
            popover.tint = FPPopoverDefaultTint;
    
            if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
            {
                popover.contentSize = CGSizeMake(300, 500);
            }
            else {
                popover.contentSize = CGSizeMake(200, 300);
            }
            popover.arrowDirection = FPPopoverArrowDirectionAny;
            [popover presentPopoverFromView:sender];
            }
            .
            .
            .
    
    }
    
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    {
    
        [popover dismissPopoverAnimated:YES];
    }
    

    //In FPTouchView.m file
    //Need to handle this method

    -(UIView*)hitTest:(CGPoint)point withEvent:(UIEvent *)event
    {
    
        UIView *subview = [super hitTest:point withEvent:event];
    
        //To-Do
        //
        return subview;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to render dynamic data using javascript which should be displayed as n
When creating dynamic ajax controls you may experience a pre-render issue on postbacks. You
I have a dynamic PDF form that has a DropDownList. I'm using iTextSharp to
Is it possible to render Razor in Html.Raw()? I have a dynamic page being
I have problem using arabic font for iOS. All fonts have the same render,
I'm having a problem using nested partials with dynamic form builder code (from the
Ok, i have a fully rendered dynamic form ( i do not know the
I'm using AngularJS with Rails and creating dynamic nested form items which are not
I'm working on a long, dynamic form (100 or so fields) and am using
I currently am using PHP to render a dynamic JS+CSS+HTML website via echo statements.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.