我正在寻找一个在NSCollectionView中检测鼠标点击的答案。所以当NSCollectionView中有一个点击时,我可以让它做一些事情。
由于
答案 0 :(得分:0)
子类data = sorted(data, key=lambda x: x["timestamp"], reverse=True)
used_keys, cleaned_data = [ ], [ ]
for item in data:
if not item['key'] in used_keys:
# if a key that we encounter in the list isn't used yet,
# add its corresponding item to cleaned_data and add it to
# used_keys so we know not to use it again.
cleaned_data.append(item)
used_keys.append(item['key'])
并实施NSCollectionView