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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T17:00:08+00:00 2026-05-19T17:00:08+00:00

I am coming from an iOS background and am new to Mac OSX (coco

  • 0

I am coming from an iOS background and am new to Mac OSX (coco app) development.

Starting with apple sample code project “Simple Cocoa App” as a base, I want to be able to switch between different “View Controllers” or even just between NSViews in any manner similar to that of iOS apps.

Unfortunately, I could not find a way to accomplish this — and the internet is rather lacking in resources tied to keywords like “View switching in cocoa apps, switching views in mac apps, mac app dev tutorials”…

Do any of you know a tutorial that, and here’s the kicker, actually covers the matter of switching between views? Or perhaps know of any quick way you might be able to explain in your Stack Overflow answer?

Proof Of Concept

A very simple proof-of-concept could be the following. In a simple app, there are two views – Screen 1 (currently displayed) and Screen 2 (hidden off screen):

STEP 1) Start app, Screen 1 appears (contains Label “Screen 1” and Button “Go Next”)
STEP 2) Press the Button
STEP 3) Screen 1 slides offscreen as
STEP 4) Screen 2 slides in (contains a single Label “Screen 2”)

Thanks.

  • 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-19T17:00:09+00:00Added an answer on May 19, 2026 at 5:00 pm

    Core Animation is not as deeply integrated in OS X as it is on iOS.
    Therefore you will need to do a lot yourself.
    What you could do is use the window’s contentView as a superview and then do the following to switch to another view ( animated ).

    - (void)switchSubViews:(NSView *)newSubview
    {
      NSView *mainView = [[self window] contentView];
      // use a for loop if you want it to run on older OS's
      [mainView removeAllSubViews];
    
      // fade out
      [[mainView animator] setAplhaValue:0.0f];
    
      // make the sub view the same size as our super view
      [newSubView setFrame:[mainView bounds]];
      // *push* our new sub view
      [mainView addSubView:newSubView];
    
      // fade in
      [[mainView animator] setAlphaValue:1.0f];
    }
    

    This won’t give you your desired effect however. If you want it to give it a sorta move effect you have to include QuartzCore.framework and do the following:

    - (void)prepareViews
    { // this method will make sure we can animate in the switchSubViewsMethod
      CATransition *transition = [CATransition animation];
      [transition setType:kCATransitionPush];
      [transition setSubtype:kCATransitionFromLeft];
      NSView *mainView = [[self window] contentView];
      [mainView setAnimations:[NSDictionary dictionaryWithObject:transition forKey:@"subviews"]];
      [mainView setWantsLayer:YES];
    }
    

    then in the switchSubViews: you only have to use:

    [[mainView animator] addSubView:newSubView];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm pretty new to mac development (coming from a web and iOS background) and
I am new to Mac/iOS development. I am coming over from C# .net. My
I am coming from iOS background and starting to learn Cocoa. On iOS unless
I'm coming to iOS development from a web dev background. Having all of my
Coming from ASP.NET into WindowsForms app development I was expecting to see the similar
I am new to ios, coming from heavy UI work in C#. I have
i am pretty new to the iOS world and since I'm coming from the
I am new to obj C, and coming from a very good C++ background.
I'm coming from iOS and trying to build the simplest master-detail OS X app
I'm trying to make an iOS 5 app that features real-time things coming from

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.