0

This is my AppDelegate.m file:

#import "AppDelegate.h"
#import "LoginViewController.h"

@implementation AppDelegate

@synthesize window = _window;
@synthesize viewController = _viewController;

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
self.viewController = [[LoginViewController alloc]    initWithNibName:@"LoginWindowController" bundle:nil];
[self.window setContentView:[self.viewController view]];
}

- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag {

[self.window makeKeyAndOrderFront:self];

return YES;
}

@end

And this is my LoginViewController.m:

#import "LoginViewController.h"

@interface LoginViewController ()

@end

@implementation LoginViewController
@synthesize usernameField;
@synthesize passwordField;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
    // Initialization code here.
}

return self;
}
- (IBAction)loginPressed:(NSButton *)sender
{
NSLog(@"Username = %@", [self.usernameField stringValue]);
NSLog(@"Password = %@", [self.passwordField stringValue]);
}

@end

How can I switch back the main view when the login button is pressed? Which is inside the auto-created file MainMenu.xib. Most of the tutorials on the net are for iOS, which is a bit different in terms of handling views. How could I animate the view transition?

Thunder
  • 611
  • 1
  • 8
  • 25

1 Answers1

0

You'll need a Navigationcontroller. Have a look at this: UINavigationController.

masche
  • 1,643
  • 2
  • 14
  • 24
  • Isn't NavigationController for iOS projects only? – Thunder Jul 04 '12 at 10:24
  • [link](http://stackoverflow.com/questions/6768142/first-mac-app-push-viewcontroller) – masche Jul 04 '12 at 10:43
  • This is a general guideline which I know already and which explicitly say, UINavigationController is iOS exclusive. I'm searching for a solution. Nevertheless thanks. – Thunder Jul 04 '12 at 11:02