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 8223703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:48:13+00:00 2026-06-07T14:48:13+00:00

i am very new to iOS development, i am stuck with issue here and

  • 0

i am very new to iOS development, i am stuck with issue here and cant find solution anywhere else.

I need to dynamically generate fields on profileDetailViewController.m which is type of UIViewController,

Fields I want on view are stored in Array which looks like this,

Array:(
        {
        fieldName = Full Name;
        value = Neil G.;
    },
        {
        fieldName = Aboutn me;
        value = "a web dev..";
    },
        {
        fieldName = State;
        value = Colorado;
    },
        {
        fieldName = City;
        value = Denver;
    },
        {
        fieldName = Website;
        value = "http://google.com";
    },
        {
        fieldName = College University;
        value = "DSU";
    },
        {
        fieldName = Graduation Year;
        value = 2011;
    }
)

I am just trying to make it like contacts in IPhone,
Initially load page as display mode with edit button, so when Edit mode it should turn into form with editable fields. Any good tutorial would be great. I will appreciate your help. Thank you.

  • 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-07T14:48:19+00:00Added an answer on June 7, 2026 at 2:48 pm

    first grab the size of your array of fields:

    int fieldCount = [Array count];

    then create a wrapperView we will place a scroll view on, since for all we know you will have more fields than you can fit on the screen!

    UIView *wrapperView = [[UIView alloc] initWithFrame:self.view.frame];
    [self.view addSubView:wrapperView];
    UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:wrapperView.frame];
    [wrapperView addSubView:scrollView];
    

    Now I’m going to just add some labels for the purposes here, but you could easily make them buttons or what have you. I will have them be 21 height with a 10 pixel space in between.

    So now we need to set the contentSize of the scrollView,

    double heightNeeded = 0;
    heightNeeded = fieldCount * 31;
    if(heightNeeded < scrollView.frame.size.height){
        heightNeeded = scrollView.frame.size.height;
    }
    

    Now we can tell the scrollView how large it content size needs to be, and then add all the labels. I am going to assume your array is filled with objects called Details which have a fieldName and a Value, because you didn’t really specify.

    [scrollView setContentSize:CGSizeMake(scrollView.frame.size.width,heightNeeded)];
    int currentY = 0;
    for(Details *thisDetail in Array){
       UILabel *thisLabel = [[UILabel alloc]  initWithFrame:CGRectMake(0,currentY,scrollView.frame.size.width,21)];
        [thisLabel setLineBreakMode:UILineBreakModeWordWrap];
        thisLabel.numberOfLines = 0;
        UILabel.text = [NSString stringWithFormat:@"%@: %@",thisDetail.fieldName,thisDetail.Value];
        [thisLabel sizeToFit];
        [scrollView addSubView thisLabel];
        currentY = currentY + thisLabel.frame.origin.y + thisLabel.frame.size.height + 10;
     }
    

    not sure if you want them to be labels like this, but that is easily changed. There may be a few more things, like implementing UIScrollViewDelegate and then scrollView.delegate = self somewhere, but I’m not sure. Hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am very new at iOS and objective-c development, so I am struggling with
I am VERY new with iOS development. So, please make your response as exact
I'm very new with iOS Development and I have just created one of my
Hi All I'm new to iOS development and am currently having an issue with
Hi I'm very new to ios development. I'm developing a map application where I
Ok, so I am very very new to iOS development and also to PHP
I am new to iOS development. For my little messenger I need a contact
I am very new to IOS programming. I have a task to find if
i am very new to ios development, rather i have just started work on
I am very new to iOS App Development . In my app I am

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.