开发者

Accessing the stringValue from NSTextFields on different NIBs

开发者 https://www.devze.com 2023-01-02 16:18 出处:网络
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\".

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 ac开发者_开发技巧ts 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.


each of their File Owner's are assigned to a NSViewController subclass which I have created for each

I think the easiest way (not the best way) is that your brain contains all 4 NSViewController subclass and you leak the information of the UITextField out using the property and then you can access them

0

精彩评论

暂无评论...
验证码 换一张
取 消