在我的自定义滚动视图中,我添加了谓词对象,如下所示。它在调试堆栈中的方法 predicateWithSubpredicates 中给出错误。这是我的示例代码,如果存在任何错误,请告诉我。
-(void) awakeFromNib
{
NSPredicateEditor *predicateeditor = [[NSPredicateEditor alloc] initWithFrame:NSMakeRect(0, 0, 200, 150)];
NSArray *leftExpressions = [NSArray arrayWithObjects:[NSExpression expressionForKeyPath:@"date"], nil];
NSAttributeType rightType = NSDateAttributeType;
NSComparisonPredicateModifier modifier = NSAllPredicateModifier; //don't need "ANY" or "ALL"
NSArray *operators = [NSArray arrayWithObjects:[NSString stringWithString:@"Today"],[NSString stringWithString:@"Tomorrow"],[NSString stringWithString:@"Next week"], nil];
NSUInteger options = 0;
NSPredicateEditorRowTemplate *rowTemplate = [[NSPredicateEditorRowTemplate alloc] initWithLeftExpressions:leftExpressions rightExpressionAttributeType:rightType modifier:modifier operators:operators options:options];
[predicateeditor setRowTemplates:[NSArray arrayWithObject:rowTemplate]];
[rowTemplate release];
[self addSubview:predicateeditor];
[predicateeditor addRow:nil];
[predicateeditor displayValuesForRow:1];
[predicateeditor release];
}