2つのエンティティを持つ単純なアプリケーションがあります。
人:
Attributes:
name
Relationships:
nativeLanguage: (<<-> Language.natives)
nonNativeLanguage: (<<-> Language.nonNatives)
言語:
Attributes:
name
Relationships:
natives: (<->> Person.nativeLanguage)
nonNatives: (<->> Person.nonNativeLanguage)
人々の編集画面には、その人々のためにリストされた非母国語をリストするためのテーブル表示セットと、別の言語を選択するためのドロップボックスと新しい言語をリストに追加するためのボタンがあります。
私の目標は、次のような関数を作成することです。
- (IBAction)addNonNativeLanguage:(id)sender {
// tack the language to the end of the list on a many-many relationship
PersonEntry.nonNativeLanaguages = PersonEntry.nonNativeLanguages + sender;
}
アクションをボタンに添付します。トリックは、通常の変数を割り当てて変更する方法は知っていますが、InterfaceBuilderの外部でコアデータのコンテンツを変更する方法がわかりません。Objective-Cでそれを行うにはどうすればよいですか?