2

uniqueOrganizationsArray[String]类型。

private let collation = UILocalizedIndexedCollation.currentCollation() as UILocalizedIndexedCollation
private var sections: [[String]] = []
let selector: Selector = ""

            sections = [[String]](count: collation.sectionTitles.count, repeatedValue: [])

            for object in uniqueOrganizationsArray {
                let sectionNumber = collation.sectionForObject(object, collationStringSelector: selector)
                sections[sectionNumber].append(object as String)
            }

String我应该在对象上使用什么选择器?

4

1 回答 1

2

您可以使用selfdescription作为字符串类型。我更喜欢self它,因为它可以与任何类型一起使用。使用 self 时,您将比较对象本身

let selector: Selector = "self"
let selector: Selector = "description"
于 2015-11-12T10:00:03.307 回答