Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 用数组绑定行编辑器_Objective C_Cocoa_Nsmutablearray - Fatal编程技术网

Objective c 用数组绑定行编辑器

Objective c 用数组绑定行编辑器,objective-c,cocoa,nsmutablearray,Objective C,Cocoa,Nsmutablearray,在开发人员文档中,我发现: NSRuleEditor公开一个绑定,行。您可以将行绑定到 有序集合(例如NSMutableArray的实例)。每个 集合中的对象应具有以下属性: @“rowType”表示行类型的整数(NSRuleEditorRowType) @“subrows”一个有序的多对多关系(例如NSMutableArray的实例),包含给定对象的直接嵌套的subrows 划船 @“displayValues”一个包含行的显示值的有序对多关系 @“条件”包含行的条件的有序到多关系 任何人

在开发人员文档中,我发现:

NSRuleEditor
公开一个绑定,
。您可以将
绑定到 有序集合(例如
NSMutableArray
的实例)。每个 集合中的对象应具有以下属性:

  • @“rowType”表示行类型的整数(NSRuleEditorRowType)

  • @“subrows”一个有序的多对多关系(例如NSMutableArray的实例),包含给定对象的直接嵌套的subrows 划船

  • @“displayValues”一个包含行的显示值的有序对多关系

  • @“条件”包含行的条件的有序到多关系


任何人都可以举例说明如何做到这一点。

==EDIT=============

正如我所研究的,
NSRuleEditor
类标题包含关于绑定的下一个文档:

* -- Bindings support -- */

/* Sets the class used when creating a new row in the "rows" binding; this class should be KVC and KVO compliant for the key paths listed below.  By default this is NSMutableDictionary */
- (void)setRowClass:(Class)rowClass;
- (Class)rowClass;

/* Set and get the key path for the row type, which is used to get the row type in the "rows" binding.  The row type is a value property of type NSRuleEditorRowType.  The default is @"rowType". */
- (void)setRowTypeKeyPath:(NSString *)keyPath;
- (NSString *)rowTypeKeyPath;

/* Set and get the key path for the subrows, which is used to determined nested rows in the "rows" binding.  The subrows property is an ordered to-many relationship containing additional bound row objects. The default is @"subrows". */
- (void)setSubrowsKeyPath:(NSString *)keyPath;
- (NSString *)subrowsKeyPath;

/* Set and get the criteria key path, which determines the criteria for a row in the "rows" binding.  (The criteria objects are what the delegate returns from - ruleEditor: child: forCriterion: withRowType:).  The criteria property is an ordered to-many relationship. The default is @"criteria". */
- (void)setCriteriaKeyPath:(NSString *)keyPath;
- (NSString *)criteriaKeyPath;

/* Set and get the display values key path, which determines the display values for a row (the display values are what the delegate returns from - ruleEditor: displayValueForCriterion: inRow:).  The criteria property is an ordered to-many relationship. The default is @"displayValues". */
- (void)setDisplayValuesKeyPath:(NSString *)keyPath;
- (NSString *)displayValuesKeyPath;
为了扩展答案,我将给出下一个示例,以便您了解如何将自己的类绑定为行:

@interface BindObject : NSObject

@property (nonatomic, assign) NSInteger rowType;
@property (nonatomic, strong) NSMutableArray *subrows;
@property (nonatomic, strong) NSMutableArray *displayValues;
@property (nonatomic, strong) NSMutableArray *criteria;

@end

// binding custom class as row class
[self.ruleEditor setRowClass:[BindObject class]];
现在,当您向
NSRuleEditor
添加新行时,将使用您的类。您还可以更改KeyPath,以便自定义行类中的字段(IVAR/属性)的调用方式可能与文档中指定的不同

希望这将帮助您了解NSRuleEditor的工作原理

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


我发现,它应该可以帮助您了解NSRuleEditor的工作原理。

遗憾的是,本文和示例代码没有介绍如何使用NSRuleEditor绑定“行”。