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

  • Home
  • SEARCH
  • 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 806375
In Process

The Archive Base Latest Questions

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

I have an MVC application with a single model and several views (something like

  • 0

I have an MVC application with a single model and several views (something like skins). I want the user to be able to switch the views and I can’t get it working with interface orientation. The most simple approach looks like this:

- (void) switchToADifferentView: (UIView*) newView {
    // self is a descendant of UIViewController
    self.view = newView;
}

This does not work because the incoming view does not get rotated according to current orientation (until the next orientation change, test case). Is there a way to force the orientation on a view? It looks like the system is trying really hard to keep the interface controls for itself. (Or is it as simple as setting the right transform by hand?)

I figured I’d better not switch the views directly and switch controllers instead. This makes sense, as it makes the initial code simpler. But how do I switch controllers that have no “navigation relation” between them? I guess I could use presentModalViewController:, but that seems like a hack. Same goes for navigation controller. If I exchange the controllers by hand, I get the wrong orientation again:

- (void) switchToAController: (id) incoming {
    [currentController.view removeFromSuperview];
    [window addSubview:incoming.view]; // does not respect current orientation
}

Now how the heck do I simply exchange the current controller for another one? Again, the controllers are something like “skins” operating above a shared model, so it really makes no sense to pretend that skin A is a “modal” dialog above skin B or that they’re a part of a navigation stack.

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

    In the end I went with a “trampoline” approach. Each “skin” is a separate controller and there is a special root controller that presents the skins as modal controllers. When the skin wants to switch to a different one, it sets a flag indicating the desired next skin and dismisses itself. The root controller wakes up (viewWillAppear), notices the flag and displays the next skin.

    This solution has two main advantages: 1] The controller code stays simple, as each controller displays one and only view, no view switching. 2] There is no need to hack the orientation code, because view orientation inside modally displayed controllers is handled transparently by the system.

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

Sidebar

Related Questions

Generally, MVC frameeworks have a structure that looks something like: /models /views /controllers /utils
I have an ASP.Net MVC application with a model which is several layers deep
I have a Rails application with several models-views-controllers which have some similar characteristics, for
I have a MVC web application (Ruby, Rack, Apache) and I want it to
I have an application, built using MVC, that produces a view which delivers summary
I've got a relatively simple question about asp.net MVC models. I've got a model
I have implemented what I thought was a pretty decent representation of MVC in
I'm trying to figure out how I can define validation rules for my domain
Recently I've read, and implemented 80% of examples from Pro ASP.NET MVC Framework ,

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.