大佬教程收集整理的这篇文章主要介绍了ios – 如何按天分组核心数据?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
有一天可能有几笔交易.
所以我想要按天计算一些数据组,我想要获取日期和数量的东西
喜欢:
2013-06-03 3 2013-06-02 4
我不想使用sectionPath,因为它只将交易放入section.
我知道我可以通过另一个属性(类型:字符串)来实现这一点,例如dayOfTheDate,就像每个对象中的2013-06-03.
你能理解我在找什么吗?
谢谢大家.
NSEntityDescription* entity = [NSEntityDescription entityForName:@"Assets" inManagedObjectContext:[appDelegate managedObjectContext]]; NSAttributeDescription* statusDesc = [entity.attributesByName objectForKey:@"notes"]; NSExpression *keyPathExpression = [NSExpression expressionForKeyPath: @"assetUrl"]; // Does not really matter NSExpression *countexpression = [NSExpression expressionForFunction: @"count:" arguments: [NSArray arrayWithObject:keyPathExpression]]; NSExpressionDescription *expressionDescription = [[NSExpressionDescription alloc] init]; [expressionDescription setName: @"count"]; [expressionDescription setExpression: countexpression]; [expressionDescription setExpressionResultType: NSInteger32AttributeType]; [searchFetchrequest setPropertiesToFetch:[NSArray arrayWithObjects:statusDesc,expressionDescription,nil]]; [searchFetchrequest setPropertiesToGroupBy:[NSArray arrayWithObject:statusDesc]]; NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"timestamp" ascending:NO]; [searchFetchrequest setSortDescriptors:@[sortDescriptor]]; [searchFetchrequest setFetchLimit:10]; NSPreDicate *query = [NSPreDicate preDicateWithFormat:@"notes contains[cd] %@",_txtCameraNote.text]; [searchFetchrequest setPreDicate:query]; [searchFetchrequest setResultType:NSDictionaryResultType]; NSArray *fetchedObjects = [appContext executeFetchrequest:searchFetchrequest error:nil];
({ count = 1; notes = "glenny and me"; },{ count = 6; notes = macair; })
以上是大佬教程为你收集整理的ios – 如何按天分组核心数据?全部内容,希望文章能够帮你解决ios – 如何按天分组核心数据?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。