0

I am new to objective C cocoa programming and I would like to know how to pass data between subviews when using a split view. The purpose is to set up a view which contains two views (top and bottom). In the topview I would like to add a combo box which holds an array of objects. When selecting an object from the list it should be displayed in the bottom view. Besides the combo box there should be a button 'Add' which allows me to set a view from a nib in the bottom view. In this view there should be a 'save' button which adds the inputed data to the array of objects and reloads the combo box of the top view including the new object. Can anybody help me out?

tnx

4

1 回答 1

0

您应该NSNotificationCenter用于此目的。在这里,找这篇文章NSNotification & NSNotificationCenter

或者它可能是一些符合某些协议的独立对象。每次用户单击保存按钮时,该对象都会从委托方法 ( -userDidInputTheData:(NSString*)data;) 接收数据,并将其传递给另一个子视图。您可以在 NSViewController 或 NSWindowViewController 子类中实现所有代码。

于 2014-09-24T08:56:39.320 回答