Accessing the stringValue from NSTextFields on different NIBs

Posted by Kyle Zaragoza on Stack Overflow See other posts from Stack Overflow or by Kyle Zaragoza
Published on 2010-06-06T01:03:31Z Indexed on 2010/06/06 1:12 UTC
Read the original article Hit count: 314

Filed under:
|

I'm having an extremely difficult time trying to access information from an object (e.g. an NSTextField) that is located on a NIB other than my "MainMenu.nib".

My current setup: I have a MainMenu.xib that contains only a toolbar at the top and an NSView. I have four other .xib files containing custom NSViews and each of their File Owner's are assigned to a NSViewController subclass which I have created for each. My MainMenu.xib contains an object that is set to my WindowController subclass that takes care of swapping the fours views into the NSView on my MainMenu.xib. All of this works fantastic.

Where I have a problem: I have another class that acts as the brains to my application which sends and receives data from an online server, all of the methods I have created rely on inputs from the user that are located on the individual .xibs that swap into my MainMenu.xib's NSview. Unfortunately I have no idea on how to grab the information from the NSTextFields, textViews, etc. that are located on my individual .xib files.

What I've tried: I have tried setting the File Owner's of the four individual .xibs to my "brains" class and connecting outlets defined in my "brains".h, but when I call [textField stringValue] I receive a NULL response. I'm thinking this is because I'm creating multiple instances of my "brains" class but not totally sure.

Any help on accessing information from textFields from other nibs would be a great benefit, thanks in advance.

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about cocoa