简体   繁体   English

Parse.com如何基于createdAt天分离对象?

[英]Parse.com how to separate objects based on createdAt day?

I've been looking to query for all of the "posts" a user has made, which I've done, and then separate them into sections in a UICollectionViewCell based on their createdAt day. 我一直在查询用户所做的所有“帖子”(我已经完成了),然后根据它们的createdAt天将它们分成UICollectionViewCell中的各个部分。 So that my collection view headers will have the day and the under there will be to posts made that day. 这样我的收藏夹视图标题将是当天,下面将是当天发表的帖子。 Perhaps I'm overthinking this too much? 也许我想得太多了? Thanks for any help! 谢谢你的帮助!

This answer provides a way to get the start and end dates for the current day. 该答案提供了一种获取当天开始日期和结束日期的方法。

You'll then have to figure out how to sort the objects, but I'll leave that up to you. 然后,您必须弄清楚如何对对象进行排序,但我将由您自己决定。

Separating a lot of objects out into sections with NSDate comparisions may or may not affect your app's performance, so you'll have to be wary of that, but don't worry about it if you don't notice anything. 使用NSDate比较将许多对象分成多个部分可能会或可能不会影响应用程序的性能,因此您必须对此有所警惕,但是如果您什么都没注意到,就不必担心。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM