
NSRuleEditorexposes one binding,rows. You can bindrowsto an
ordered collection (such as an instance ofNSMutableArray). Each
object in the collection should have the following propertIEs:@”rowType” An integer representing the type of the row(NSRuleEditorRowType).
@”subrows” An ordered to-many relation (such as an instance of NSMutableArray) containing the directly nested subrows for the given
row.@”displayValues” An ordered to-many relation containing the display values for the row.
@”criteria” An ordered to-many relation containing the criteria for the row.
任何人都可以举例说明如何做到这一点?
解决方法 ===========编辑=============在我研究过的时候,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,因此可以调用@R_419_6942@行类中的字段(ivars / propertIEs),而不是文档中的特定字段.
希望这能帮助您了解NSRuleEditor的工作原理.
– = – = – = – = – = – = – = – = – = – = – = – = – = – = – = –
我找到了this article,它应该可以帮助你理解NSRuleEditor的工作原理.
总结以上是内存溢出为你收集整理的objective-c – 用数组绑定NSRuleEditor行全部内容,希望文章能够帮你解决objective-c – 用数组绑定NSRuleEditor行所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)