iphone Programming Glossary: predicatewithformat
How to correctly setup a NSPredicate for a to-many relationship when using Core Data? http://stackoverflow.com/questions/1347776/how-to-correctly-setup-a-nspredicate-for-a-to-many-relationship-when-using-core as the day property of any ExludedDay entity. I started trying NSPredicate dayIsNotExcludedPredicate NSPredicate predicateWithFormat @ ALL excludedDays.day @ today However despite what the documentation says ALL does not work and the application throws.. to devise the following predicate with the help of various people NSPredicate dayIsNotExcludedPredicate NSPredicate predicateWithFormat @ excludedDays.@count 0 excludedDays.@count 0 NONE excludedDays.day @ today While this worked at first I have just discovered.. with missing and or inconsistent documentation. The correct predicate in this case is the following one NSPredicate predicateWithFormat @ excludedOccurrences.@count 0 OR 0 SUBQUERY excludedOccurrences sub sub.day @ .@count today In the predicate a subquery..
UISearchView not displaying search values http://stackoverflow.com/questions/13985379/uisearchview-not-displaying-search-values void filterContentForSearchText NSString searchText scope NSString scope NSPredicate resultPredicate NSPredicate predicateWithFormat @ SELF contains cd @ searchText self.searchResults self.allItems filteredArrayUsingPredicate resultPredicate BOOL searchDisplayController.. void filterContentForSearchText NSString searchText scope NSString scope NSPredicate resultPredicate NSPredicate predicateWithFormat @ SELF contains cd @ searchText self.mySections self.mySections filteredArrayUsingPredicate resultPredicate myTableView..
How to validate an url on the iPhone http://stackoverflow.com/questions/1471201/how-to-validate-an-url-on-the-iphone
Core Data and Core Location http://stackoverflow.com/questions/2176127/core-data-and-core-location 1 float latMin wantedLat 1 float lngMax wantedLng 1 float lngMin wantedLng 1 NSPredicate predicate NSPredicate predicateWithFormat @ lat f and lat f and lng f and lng f latMin latMax lngMin lngMax Though depending on how much data you have and how closely..
NSFetchedResultsController refresh refetch? http://stackoverflow.com/questions/3399012/nsfetchedresultscontroller-refresh-refetch NSArray alloc initWithObjects sortDescriptor nil if showAll NO if isXSelected NO NSPredicate predicate NSPredicate predicateWithFormat @ isFirst TRUE fetchRequest setPredicate predicate if isXSelected YES NSPredicate predicate NSPredicate predicateWithFormat.. @ isFirst TRUE fetchRequest setPredicate predicate if isXSelected YES NSPredicate predicate NSPredicate predicateWithFormat @ isFirst FALSE fetchRequest setPredicate predicate fetchRequest setSortDescriptors sortDescriptors fetchRequest setEntity..
How to get matches in iOS using regular expression? http://stackoverflow.com/questions/4184845/how-to-get-matches-in-ios-using-regular-expression like NSString string @ stackoverflow.html NSString expression @ stack . .html NSPredicate predicate NSPredicate predicateWithFormat @ SELF MATCHES @ expression BOOL match predicate evaluateWithObject string But that only tells I got a match and doesn't..
How to filter NSFetchedResultsController (CoreData) with UISearchDisplayController/UISearchBar http://stackoverflow.com/questions/4471289/how-to-filter-nsfetchedresultscontroller-coredata-with-uisearchdisplaycontroll array if searchString.length your search predicate s are added to this array predicateArray addObject NSPredicate predicateWithFormat @ name CONTAINS cd @ searchString finally add the filter predicate for this view if filterPredicate filterPredicate NSCompoundPredicate..
Getting a list of files in a directory with a glob http://stackoverflow.com/questions/499673/getting-a-list-of-files-in-a-directory-with-a-glob defaultManager NSArray dirContents fm contentsOfDirectoryAtPath bundleRoot error nil NSPredicate fltr NSPredicate predicateWithFormat @ self ENDSWITH '.jpg' NSArray onlyJPGs dirContents filteredArrayUsingPredicate fltr If you need to do it with NSURL instead.. includingPropertiesForKeys @ options NSDirectoryEnumerationSkipsHiddenFiles error nil NSPredicate fltr NSPredicate predicateWithFormat @ pathExtension '.jpg' NSArray onlyJPGs directoryContents filteredArrayUsingPredicate predicate share improve this answer..
NSPredicate endswith multiple files http://stackoverflow.com/questions/5032541/nspredicate-endswith-multiple-files documentsDirectoryPath error nil NSArray files dirContents filteredArrayUsingPredicate NSPredicate predicateWithFormat @ self CONTAINS @ NSArray arrayWithObjects @ .mp4 @ .mov @ .m4v @ .pdf @ .doc @ .xls nil iphone objective c nspredicate..
Email validation on textField in iPhone sdk http://stackoverflow.com/questions/5428304/email-validation-on-textfield-in-iphone-sdk NSString email NSString emailRegex @ A Z0 9a z._ @ A Za z0 9. . A Za z 2 4 NSPredicate emailTest NSPredicate predicateWithFormat @ SELF MATCHES @ emailRegex return emailTest evaluateWithObject email For a bunch of emails separated by a comma NSMutableArray.. email in emailArray NSString emailRegex @ A Z0 9a z._ @ A Za z0 9. . A Za z 2 4 NSPredicate emailTest NSPredicate predicateWithFormat @ SELF MATCHES @ emailRegex if emailTest evaluateWithObject email validEmails addObject email return validEmails autorelease..
Coredata Error “data: <fault>” http://stackoverflow.com/questions/7304257/coredata-error-data-fault NSEntityDescription entityForName @ Cave inManagedObjectContext self.context request.predicate NSPredicate predicateWithFormat @ latitude 0 AND longitude 0 NSError error NSLog @ @ self.context executeFetchRequest request error error NSLog @ @ error..
iCloud basics and code sample [closed] http://stackoverflow.com/questions/7795629/icloud-basics-and-code-sample setSearchScopes NSArray arrayWithObject NSMetadataQueryUbiquitousDocumentsScope PREDICATE NSPredicate pred NSPredicate predicateWithFormat @ K @ NSMetadataItemFSNameKey @ text.txt query setPredicate pred FINISHED NSNotificationCenter defaultCenter addObserver..
|