nspredicate

tableView:didSelectRowAtIndexPath: call to current-view Parser delegates

守給你的承諾、 提交于 2019-12-06 15:53:36
I have some pretty interesting logic going, basically I have this data which I want to check over before I display the next view.. just in case the data is empty I want to pop the view, if the data is not empty then I want to load the the view to display it onto the navigational stack. so in my tableView:didSelectRowAtIndexPath: method, when the selection is made I, get the current selection ID number so I can restrict the values of the data Im going to parse to only related values. This is what the code looks like inside my method. #pragma mark - Table view delegate - (void)tableView:

How to use NSPredicate to filter NSMutableSet which contains composite object from other Class?

本小妞迷上赌 提交于 2019-12-06 13:04:01
Newbie Questions, I have 3 Class, 3 of them are subclass from NSOBject. Collection Class , have 2 properties, masterSong as NSMutableSet (strong, nonatomic) and listOfPlaylists as NSMutableArray (strong, nonatomic) Playlist Class Have 2 properties, playListName as NSString (copy, nonatomic) and songList as NSMutableArray (strong, nonatomic) 3 . Song Class Have 4 properties: title,artist,album, playtime as NSString (copy, nonatomic). masterSong will contain Song object, and listOfPlaylist will contain Playlist Object. while songList only store reference to Song Object. I want to create

Filter an NSDictionary of Arrays using NSPredicate

耗尽温柔 提交于 2019-12-06 12:52:37
问题 I have a plist that I have defined as a Dictionary that contains many arrays. I would like to pull out of that dictionary all arrays that have their first "Item 0" (Default naming convention) that matches a given string. I tried something similar to Filtering an NSArray, but I am getting a regex error and the console spews out the contents of the first array in the dictionary. Also, would I need to instantiate my NSDictionary as an NSMutableDictionary since I will be performing a filter

NSPredicate not working with calculated field

被刻印的时光 ゝ 提交于 2019-12-06 12:34:39
I have a Core Data project and am having difficulty searching the data with a simple calculated field and have no idea why it's not working. I have a Tutor entity, with core data string attributes "tutorFirstName" and "tutorLastName". I've created an additional string attribute "tutorFullName" which is populated in a Category as such: NSString *fullName = [@[self.tutorFirstName, self.tutorLastName] componentsJoinedByString:@" "]; The data is populated fine, but when I perform the following searches only the predicates on the tutorFirstName and tutorLastName work: NSPredicate *predicate =

Displaying Core Data: If attribute has same name display once

余生长醉 提交于 2019-12-06 12:29:01
I have viewed numerous predicate questions, I have read the docs and nothing seems to be jumping out as an answer my problem. I have a Core Data entity named Materials and I have the Attributes category , subcategory and description . I have three UITableViewControllers and in each I want to use a predicate to display as follows: TableViewController 1: Only the categories (no repeating of category names) Select a category and go to TableViewController 2. TableViewController 2: Display Subcategories (no repeating of subcategory names) Select a subcategory and go to TableViewController 3 listing

Returning a list of directories with NSMetadataQuery and NSPredicate

佐手、 提交于 2019-12-06 11:59:57
问题 I'm trying to get a list of directories in the user's iCloud folder. I worked out how to look for special types of files (such as txt files) and it works fine: NSMetadataQuery *query = [[NSMetadataQuery alloc] init]; _query = query; //Search all files in the Documents directories of the application’s iCloud container directories: [query setSearchScopes:[NSArray arrayWithObject:NSMetadataQueryUbiquitousDocumentsScope]]; NSPredicate *pred = [NSPredicate predicateWithFormat:@"%K ENDSWITH '.txt'"

NSPredicate with sub array

落爺英雄遲暮 提交于 2019-12-06 10:39:59
I am looking at the following type of data structure: { author = "Author 1"; channelIds = ( 7 ); }, { author = "Author 2"; channelIds = ( 7, 1 ); }, , { author = "Author 3"; channelIds = ( 3, 7 ); } I'd like to build an array consisting of all items where channeldIds = 7 . I was trying things along the lines of the following predicate: NSPredicate * filterById = [NSPredicate predicateWithFormat:@"channelIds[0] = '7'"]; How can I do what I'd like here? I can have an x number of channelIds, is there any way to iterate in the predicate? Tia, S. Easier: NSPredicate *filterById = [NSPredicate

NSMetadataQuery does not find NSFileWrapper folder bundles, only files (but they're there)

五迷三道 提交于 2019-12-06 07:24:49
I have a strange problem which I can't seem to solve on my own. Any help or thought is appreciated. The problem: NSMetadataQuery finds normal files (like test.txt) but no filewrapper bundle (myWrapperDocument.pro) However, NSFileManager finds all files in my ubiquity container - so the files are there, but NSMetadataQuery doesn't find them! The facts: UIDocument based app using NSFileWrappers Shared Ubiquity Container (for iOS and Desktop app) Works perfect on Mac OS Works perfect on my iPad Mini and my iPhone 4S and iPhone 3GS (running iOS6 and iOS5) Doesn't work on my iPad1 nor on most of my

CoreData conditionally fetching on NSDate using NSPredicate (swift)

岁酱吖の 提交于 2019-12-06 06:52:50
问题 Basically I have an entity called TimeLoc that has three attributes: time, latitude and longitude. And their types are Date, Double and Double respectively. I got stuck when I was trying to make a request with filter on attribute time. Here is my code: ... var appDel: AppDelegate = (UIApplication.sharedApplication().delegate as! AppDelegate) var context: NSManagedObjectContext = self.managedObjectContext! var request = NSFetchRequest(entityName: "TimeLoc") var endTime = NSDate() var startTime

NSPredicate and arrays

佐手、 提交于 2019-12-06 05:26:32
I've got a short question. I have an NSArray filled with Cars (which inherits from NSObject). Car has the @property NSString *engine (also regarded @synthesize ) Now I want to filter the array using NSPredicate : predicate = [NSPredicate predicateWithFormat:[NSString stringWithFormat:@"(engine like %@)", searchText]]; newArray = [ArrayWithCars filteredArrayUsingPredicate:predicate]; This throws an valueForUndefinedKey error. Is the predicateWithFormat correct? Thanks for your responses. Here's the real reason why it's not working: When you build a string using stringWithFormat: , it's going to