gpt4 book ai didi

ios - 带有字符串数组的 UILocalizedIndexedCollat​​ion

转载 作者:可可西里 更新时间:2023-11-01 01:42:03 24 4
gpt4 key购买 nike

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 对象上使用什么选择器?

最佳答案

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

let selector: Selector = "self"
let selector: Selector = "description"

关于ios - 带有字符串数组的 UILocalizedIndexedCollat​​ion,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28949766/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com