#import “ViewController.h”
#import “SecondViewController.h”
//新建一个类@interface SecondViewController 继承于 NSViewController
//在ViewController上弹出SecondViewController
//及一个视图控制器,弹出另外的一个视图控制器
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
}
-
(IBAction)pushNextController:(NSButton *)sender {
NSStoryboard * mainSB = [NSStoryboard storyboardWithName:@“Main” bundle:nil];
//记得要设定SecondViewController的Story board ID
SecondViewController * secondVC=[mainSB instantiateControllerWithIdentifier:@“message”];
//这样传值还无效
secondVC.label.stringValue = @“I am SecondViewController”;//这种方式还不行,必须要下面的方式
// [secondVC.view.window orderFront:nil];
[self.view addSubview:secondVC.view];
}