Вопрос

Here's my problem: I have a MainWindow.xib, Window1.xib, Window1Controller.h, Window1Controller.m I can display Window1 from MainWindow, but the passing value does not display on Window1, I know that value is ready to display, I create a button on Window1 and I can invoke this value. How can I display passing value after loaded Window1.

Here's my code:

AppDelegate.m

- (IBAction)openWindow1:(id)sender {
    Window1Controller *w1 = [[Window1Controller alloc]initWithWindowNibName:@"Window1"];
    [w1 showWindow:nil];
}

Window1Controller.m

- (void)displayInfo {
    [label setStringValue:@"sample passed text"];

    NSLog(@"%@",[label stringValue]);
}

- (id)initWithWindow:(NSWindow *)window
{
    self = [super initWithWindow:window];
    if (self) {
        // Initialization code here.
    }

    return self;
}

- (void)windowDidLoad
{
    [super windowDidLoad];

    // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.

    [self displayInfo];
}

Нет правильного решения

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top