core data - Filter out child entities from parents and display the results in iOS -
My problem is very common and lame (for me), although I can not find the solution
I have a basic setup of basic data, a source object that works as a parent, and has many connections with its item . The item object is now just one itemName property is simplicity. I display these values in a table view, because the source objects are sections and their child bodies are the table view tables. All the great when I want to bring buses, because I only fetch the source object and display all their items. The problem comes when I want to filter these values from text in the search bar. I do not know what type of use I should use to get the desired value, I want to display items that include text entered in the search bar in the ItemName property. I tried the code below, but it does not help, it displays the right source object (one or more items have their letters), but it will show all their items children's objects, Whom I do not want :) Any ideas? I think it is very easy to solve, but I do not know how. Thanks in advance. :) Believing that relationships are multiple-to-one, I recommend that you get The result will not bring the controller to (To follow the convention, I recommend changing your attribute name to
NSPredicate * predicate = [NSPredicate predicateWithFormat: @ "item. @ Count! = 0 more item. [C]% @ in searchname, searchTerm]; NSSortDescriptor * dateSortDescriptor = [NSSortDescriptor sortDescriptorWithKey: @ "Modification Date" ascending: no]; Return [auto fetchCoreDataForEntityName: @ "Source" with advanced: Bill with Sartadcopyter: DateScopySpeaker];
source , but with the
item unit
sectionNameKeyPath and the attribute name for its
source Set up, e.g.
@ "source.title" . Now ingenious is straightforward:
[Nupdicket project with format: @ "item name [c]% @", searchstress];
name .
item.itemName seems unnecessary Is.)
Comments
Post a Comment