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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:51:59+00:00 2026-06-01T12:51:59+00:00

I am making some sort of form with many input fields (some are textfields,

  • 0

I am making some sort of “form” with many input fields (some are textfields, some are switches, some gather info from pickers etc).
There are 6 sections in this form, and the nature of some answers influences the rest of the interface (for example, if you select that you own a car, more options will show below that).

In order to accomplish that, I started making a very large view (mainView) that is subview of a UIScrollView, however it was getting too big so I decided to create one nib file for each section. I set the file owner of each nib file to my MainFormViewController, and then I create an outlet for each view: section1View, section2View etc. I load the section views in -viewDidLoad like this:

// Section 1
UINib *nib1  = [UINib nibWithNibName:@"Section1" bundle:nil];
[nib1 instantiateWithOwner:self options:nil];
CGRect frame1 = self.section1View.frame;
frame1.origin.y = 10;
[self.section1View setFrame:frame1];
[self.mainView addSubview:self.section1View]; // mainView is the one I add to the scrollView

// Section 2 (goes 10px below section 1)
UINib *nib2  = [UINib nibWithNibName:@"Section2" bundle:nil];
[nib2 instantiateWithOwner:self options:nil];
CGRect frame2 = self.section2View.frame;
frame2.origin.y = frame1.origin.y + frame1.size.height + 10;
[self.section2View setFrame:frame2];
[self.mainView addSubview:self.section2View];

// Same approach for all other sections
// ...

Now this seems to work fine, however my problem is that when I change the height of these section subviews, I can’t get the rest of the subviews to adapt to the height change. For example, if I change the height of the first section:

CGRect mainFrame = self.mainView.frame;
CGRect section1Frame = self.section1View.frame;
section1Frame.size.height -= 150;
mainFrame.size.height -= 150;
[UIView animateWithDuration:0.3 animations:^(){
    self.section1View.frame = section1Frame;
    self.mainView.frame = mainFrame;
    self.scrollView.contentSize = mainFrame.size;
} completion:^(BOOL finished){
    //
}];

The rest of the views (section2View, section3View etc) do not “follow” the change in the frame of the mainView, whatever orientation I tried. To my understanding, changing the frame of the mainView should influence the frame of its subviews, according to the subviews’ autoresizing options, right? In my case the subviews just stay in the same place.
The “Autoresize Subviews” option of the main view in Interface Builder is selected.

Can anybody help me out with that?

  • 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-01T12:52:00+00:00Added an answer on June 1, 2026 at 12:52 pm

    Are you expecting the other sections to go 150pxs up? I think there is no autoresizing mask that can accomplish that.

    If your section2View has fixed top margin, even if its superview’s size changes it won’t move. If its top margin is flexible and bottom margin is flexible, it will move, but only 75pxs. If only top margin is flexible, it will move up correctly but that will work only when section 1 is changed.

    Summary:
    You have to fix the position of all of your sections manually when changing the size of one of them.
    If you put the sections into a NSArray, it will get really easy.

    Or better – use a UITableView which is perfect for this situation.

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

Sidebar

Related Questions

I'm currently making some system that will gather statistical reports from different sites, for
I am making some sort of turn-based battle system in a JFrame where the
I have a feeling I am making some sort of foolish mistake here, however
I'm new to rails and making some sort of noob mistake: I frequently need
Is there some sort of a cache in visual studio 2008? Because when I
The title sort of explains itself. I am making some 'genrative' artwork in flash.
I am starting my first programming project in PHP making some sort of web
While making some final tests of a class-library that I'm writing for Windows Mobile
im making some script with mechanize.browser module. one of problem is all other thing
We're making some calls to some very simple JSON web services in .NET CF

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.