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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:43:50+00:00 2026-05-16T18:43:50+00:00

I recently discovered that UIView s should only have UIViewController s when they fill

  • 0

I recently discovered that UIViews should only have UIViewControllers when they fill the entire window (or are managed by another UIViewController such as a UINavigationController or UISplitViewController). This quotation is from the documentation for UIViewController:

You should not use view controllers to manage views that fill only a part of their window—that is, only part of the area defined by the application content rectangle. If you want to have an interface composed of several smaller views, embed them all in a single root view and manage that view with your view controller.

I usually put my view logic in the UIView even when it is managed by a UIViewController, yet I often find myself needing to access properties of the UIViewController such as its navigationController property. However, UIViews are not supposed to be aware of their UIViewController.

My conclusion is that view logic should go in a UIView’s UIViewController when one exists, and in the UIView itself otherwise.

Alternatively, is it better practice to create a controller class for a view which is not a subclass of UIViewController? UIPopoverController (an NSObject subclass) appears to follow this pattern, although in most cases (UIButton, etc.) views do not seem to have dedicated controller classes.

  • 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-16T18:43:51+00:00Added an answer on May 16, 2026 at 6:43 pm

    Application logic should never go in a UIView. Period. The purpose of a UIViewController is to manage a view and its subviews and, under most circumstances, is the appropriate place for the logic. UIKit adheres to the Model-View-Controller paradigm. Models hold the data, views display it and accept input, and controllers manage the interaction between the other two layers. That’s why the controller is the logical place for application logic. In iOS, UIViewController and its subclasses are the usual controller classes. I’d suggest reading up on Apple’s guidance to better understand this pattern and how it’s used in iOS.

    The quote from Apple’s documentation is telling you that you don’t create a UIViewController for each label or button. You create one for each “page” or “screen” of your application and you use it to manage the controls in that view. Notice that UIKit has classes to manage table views, tab views and navigation views. That’s the level of object that you would use UIViewController to manage.

    I’d recommend browsing through the iOS examples included with the SDK. They should give you a good idea of how the framework expects applications to be structured.

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

Sidebar

Related Questions

I recently discovered a table in our Sybase database at work that uses a
I recently inherited some code that someone else had written. I discovered that everywhere
I'm very new to lisp and recently i discovered the thin that I don't
Longtime Eclipse user here; I recently discovered the Block Selection Mode (Alt-Shift-A) that was
I just recently discovered an INotifyPropertyChange interface. I managed to implement this interface in
I have a third party dll, that is supposed to return machine name. Sometimes
Recently, I've been running some tests with C++ and VB.NET to compare execution speeds.
I recently encountered a situation where my CouchDB instance used all available disk space
I've written an application with a plug-in feature, and if a plug in doesn't

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.