且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用NSSortDescriptor将'nil'值保留在列表的底部

更新时间:2022-12-06 17:45:09

在与同事协商后更新:)



首先,你是在说一个空格的字符串中的空格还是'nil',这是一个没有价值的属性?

Update after some consulting with colleagues :)

First, are you talking about "blank" as in a string with spaces in it or 'nil' which is a property with no value at all?

一个想法是添加一个 BOOL 调用 hasFirstName 首先在 hasFirstName ,然后在 firstName 上排序。

An idea that came up would be to add a BOOL called hasFirstName and then sort first on the hasFirstName and then sort on firstName.