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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:14:16+00:00 2026-05-25T00:14:16+00:00

I’ll start my question by stating what I’m trying to do in my app:

  • 0

I’ll start my question by stating what I’m trying to do in my app:

I’m trying to build a document “picker” screen, similar to Pages or Numbers on the iPad, something that looks like this:

enter image description here

I’d like to have a UIScrollView that I drop subviews in; those subviews might have controls on them, like the Date/Name “sort” segmented control in Pages/Numbers, or they might be images of documents. It doesn’t really matter what the subviews display – what I’d like is for the subviews to be views with backing UIViewControllers. This is where my confusion starts.

See, I originally tried to build my document picker screen by using a UITableView. For various reasons beyond the scope of this question, that did not work out. As part of that effort, I created UITableViewCell subclasses (and accompanying XIBs), as per this tutorial (Creating a custom UITableViewCell in iOS 4). I thought to myself, this is great – I have views that I can show in a UITableView, and have a way to get events from those views, in a way such as this (sortTypeChanged responds to a selection change in my Date/Name segmented control):

@interface DocSortViewController : UITableViewCell {
}

-(IBAction)sortTypeChanged:(id)sender;
@end

This was all well and good – until I realized UITableView was not going to get me what I wanted. So I abandoned it, in favor of UIScrollVIew. However, this is where my current knowledge fails me. The “use a view controller/XIB view” paradigm for custom UITableViewCells does not seem to work for UIScrollViews.

I cannot figure out how to create a separate view controller and accompanying XIB that I can load and display in my UIScrollView. Attempts at loading the XIB via UINib.instantiateWithOwner and adding the view controller’s view property as a subview crashes. I’m not sure why.

What concerns me, though, is that it seems I’m fundamentally misunderstanding how view controllers/views work. Especially when coupled with UIScrollViews.

What am I missing? Has anyone tried to do something similar to this? Is there a recommended best practice for this? If you’re not supposed to load view controllers/XIBs into UIScrollViews, what are you supposed to do, then? How would you get events from controls on subviews residing in UIScrollView?

Edit: I should add that part of my problem is that I’m looking at this through the lens of WPF, where, using the MVVM pattern, you’d build a full view by composing it of smaller views, each with their own backing view model. Is it realistic to replicate that in iOS? Or is it not really recommended?

  • 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-25T00:14:16+00:00Added an answer on May 25, 2026 at 12:14 am

    In iOS, a “view controller” is a special entity that usually controls an entire screen’s worth of subviews (UISplitViewController and UIPopoverController on iPad are the exception). The tutorial you link is wrong in telling you to create a view controller xib for the UITableViewCells. What you should have done is create an xib for your UITableViewCell subclass, no view controller involved. The rest of it seems more or less correct at first glance, though.

    You can do about the same thing with a UIScrollView, except that you don’t have a handy tableView:cellForRowAtIndexPath: method to tell you when to create the subviews from the xib. Without your posting the actual error you get when it “crashes” I can only guess, but I guess whatever object you are providing as the owner for instantiateWithOwner:options: does not match what the nib expects. The object you pass as owner must be an instance of whatever class the owner is specified as in the nib.

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

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
Specifically, suppose I start with the string string =hello \'i am \' me And
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka

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.