これは私の AppDelegate.m ファイルです:
#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
そして、これは私の 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
ログインボタンが押されたときにメインビューに戻すにはどうすればよいですか? これは、自動作成されたファイル MainMenu.xib 内にあります。ネット上のチュートリアルのほとんどは iOS 用であり、ビューの処理に関しては少し異なります。ビューの遷移をアニメーション化するにはどうすればよいですか?