(tags: coverflow coreanimation iphone)
(tags: dtrace debugging performance tuning cocoa)
Dynamic Property Names Because string variables are surrounded by quotation marks when they are substituted into a format string using %@, you cannot use %@ to specify a dynamic property nameāas illustrated in the following example.
NSString attributeName = @"firstName"; NSString attributeValue = @"Adam"; NSPredicate *predicate = [NSPredicate predicateWithFormat:@"%@ like %@", attributeName, attributeValue]; The predicate format string in this case evaluates to "firstName" like "Adam".
If you want to specify a dynamic property name, you use %K in the format string, as shown in the following fragment.
predicate = [NSPredicate predicateWithFormat:@"%K like %@", attributeName, attributeValue]; The predicate format string in this case evaluates to firstName like "Adam" (note that there are no quotation marks around firstName).
(tags: nspredicate cocoa tips format)