Xcode 7: Binding an array controller to a radio button group

▼魔方 西西 提交于 2019-12-02 11:21:40

You can bind the button state through objectValue (NSTableViewCell) in a view-based table, and representedObject in a collection view (NSCollectionViewItem).

If an NSArrayController is configured to generate cells/items for those parent views, the views will maintain the state of the objectValue and representedObject binding targets for each view in the collection.

So in IB, you have one generic subview with a radio button in it, and you should be able to select "Collection View Item" with a keypath of representedObject.<whateverKeyPath> for the binding of the radio button if it's within a collection view item. Or you could select "Table View Cell" with a keypath of objectValue.<whateverKeyPath> if the button is a subview of a table view cell for a view-based table.

Though it may be dated by recent OSX 10.10 updates to NSCollectionView, the quick start guide has good illustrations on how to configure bindings within subviews of collection views. Table view subview bindings are similar, though you use objectValue rather than representedObject as the property within the view.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!