ios - How to create a predicate that compares all properties of an object? -


For example, I have an object that has three properties: first name, middle name, last name.

[NSPredicate predicateWithFormat: @ "(first name in [CD]% @) or (last name [CD]% @) or (in middle name [Cd]% @) ", @" Joynion ", @" John ", @" Joy "];

Can I do something like this:

[NSPredicate predicateWithFormat: @ "(all in [CD]% @), @" John "] ;

"Includes everything" does not work in an ingenious, and ( As far as I know) there is no single syntax, get desired results.

The "Code of Definition" from all the "string" attributes in the following code unit creates:

 < code> NSString * searchText = @ "john"; NSEntityDescription * entity = [NSEntityDescription EntityForName: @ Managed objects in "Entity" (If [[attr isKindOfClass: [NSAttributeDescription class]]) {if ([attr attributeType] == NSStringAttributeType} {NSPredicate * tmp = [NSPredicate predicateWithFormat: @ "NSMutableArray array: % K contains [CD]% @ ", [the name of the deal], search text]; [subproducts addObject: tmp];}}} NSPredicate * predicate = [NSCompoundPredicate or PredicateWithSubpredicates: subPredicates]; NSLog (@ "% @", forecast); The first name is [cd] "John" or the last name [CD] is "John" or middle name [CD] "John"    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -