Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我必须比较许多托管对象并按日期对它们进行分组。NSDate我不能使用 NSDateComponents 因为比较两个对象太慢了。
NSDate
如何以更有效的方式比较它们,从而节省处理时间?
我不确定你在做什么样的比较,但你可以这样做:
if ( [date1 timeIntervalSince1970] > [date2 timeIntervalSince1970]) { NSLOG(@"Do something"); }
因此,如果 date1 比 date2 大(1970 年更远!),则 if 为真。这将比 NSDateComponents 工作得更快。
I have some object tags that each embeds a svg file. Clicking on the object tag (the svg), should call a javascript function. As I understand, the object tag doesn't support mouse events.