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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:22:04+00:00 2026-05-20T06:22:04+00:00

I’m a long-time web guy who’s pretty new to iphone development. I’m finding many

  • 0

I’m a long-time web guy who’s pretty new to iphone development. I’m finding many problems I run into stem from thinking about things in terms of web pages, so it’s very possible I’m just not asking the right questions on this one. Nonetheless, after a few hours pouring over google results and stackoverflow pages, time to throw this question out into the void:

I’m trying to set up a view that has some static/un-moving stuff at the very top (for example, the title of the content shown below), and allow the rest of the “page” to scroll.

My thought process as it stands now is to create a view that holds the static portion, and a blank space, and then somehow add a scrollview to that blank space, but this is where my knowledge is running dry.

Code-wise, it’s looking something like this (i’ve added comments to show my thought process on using this code):

DetailsWrapper.m:

-(void)viewDidLoad {

    //initialize details view (custom constructor that populates some stuff)
    //ListingDetails is a subclass of UIViewController whose view is set to be a UIScrollView created in IB
    //the viewDidLoad method of ListingDetails sets the contentSize of the scroll view
    ListingDetails *details = [[ListingDetails alloc] initWithNibName:@"ListingDetails" andListingData:theListing];

    //create an empty view that takes up all but the top 45px of the iphone screen
    CGRect scrollArea = CGRectMake(0.0f, 45.0f, 320.0f, 435.0f); 
    UIView *scrollView = [[UIView alloc] initWithFrame:scrollArea];

    //add the UIScrollView to the space we just made
    [scrollView addSubview:details.view];

    //now show it
    [self.view addSubview:scrollView];

    //cleanup
    [scrollView release];
    [details release];
}

That all works fine and dandy, and pulls in the content correctly, with the minor problem that the scroll view doesn’t actually…scroll. If I try to add the ListingDetails view normally, without using this wrapper, the scrolling works just fine, but something I’m doing (or not doing?) above is making the scroll functionality cease to be.

Am I thinking about this all wrong? Ultimate goal is to get a screen where part of it scrolls and part does not, so if it helps to ignore all my rambling above and just address that, go for it.

  • 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-05-20T06:22:05+00:00Added an answer on May 20, 2026 at 6:22 am

    First off, only one UIViewController per screen. Period. From there you will want two subviews added to UIViewController’s main view (the one that’s loaded in viewDidLoad). To put this into web terms think of the view controller’s view as <body></body>.

    In the end you’ll probably want something like this.

    - (void)viewDidLoad
    {
        [super viewDidLoad];
    
        UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 45.0)];
        // Further configure your scroll view as you presumably already have in ListingDetails
        [self.view addSubview:scrollView];
        [scrollView release];
    
        UIView *staticView = [[UIView alloc] initWithFrame:CGRectMake(0.0, 45.0, 320.0, 435.0)];
        [self.view addSubview:staticView];
        [staticView release];
    }
    

    Edit: Setting this up in Interface Builder

    In your view controller’s .h

    @interface SampleViewController : UIViewController
    {
        UIScrollView *scrollView;
        UIView *staticView;
    }
    
    @property (nonatomic, retain) IBOutlet UIScrollView *scrollView;
    @property (nonatomic, retain) IBOutlet UIView *staticView;
    
    @end
    

    and in the .m file

    @implementation SampleViewController
    
    @synthesize scrollView;
    @synthesize staticView;
    
    - (void)viewDidUnload
    {
        [super viewDidUnload];
        self.scrollView = nil;
        self.staticView = nil;
    }
    
    - (void)dealloc
    {
        [scrollView release], self.scrollView = nil;
        [staticView release], self.staticView = nil;
        [super dealloc];
    }
    
    @end
    

    Now in the Interface Builder file, you can right-click and drag from File’s Owner (that’s your UIViewController subclass) directly to the views on screen. When you release a popup will appear and you choose the property in the code you want to connect that view to. Once this is established you can reference those views in code like so.

    - (void)viewDidLoad
    {
        [super viewDidLoad];
    
        // Assume we need to make some tweaks once the view has loaded
        self.staticView.backgroundColor = [UIColor redColor];
        self.scrollView.backgroundColor = [UIColor blackColor];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
Seemingly simple, but I cannot find anything relevant on the web. What is the
this is what i have right now Drawing an RSS feed into the php,
I want to count how many characters a certain string has in PHP, but
I have a French site that I want to parse, but am running into
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have just tried to save a simple *.rtf file with some websites and

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.