在真实的 iOS 设备上写入两次的字符串,但在模拟器上是正确的

A string written twice on real iOS device, but correct on simulator

提问人:Fathya 提问时间:9/20/2023 最后编辑:HangarRashFathya 更新时间:9/21/2023 访问量:34

问:

字符串是 'Match Points:

在任何真实的 iOS 设备上:

enter image description here

在模拟器 iPhone 14 Pro 上:

enter image description here

当用户选择并启用搜索过滤器时,芯片会出现。didSelectItemAt 上有代码

SeleectFilterTableViewCell.swift

“filter_poin_balance” = “赛点: %points%”

let dataFilter = selectedChips.filter { $0.code == userPoint }
if !dataFilter.isEmpty {
    selectedChips = selectedChips.filter() { $0.code != userPoint }
} else {
    let title = wcmsLocalized("filter_poin_balance")?.replacingOccurrences(of: "%points%", with: userPoint) ?? ""
    let selectedData = AmountPointSelected(isPoin: false, title: title, code: userPoint)
    selectedChips.append(selectedData)
}

这是我在cellForItemAt上召唤芯片的代码

SearchTableViewCell.swift

pointChips = [数量PointSelected]

if let cell = collectionView.dequeueReusableCell(withReuseIdentifier: SearchItemCell.identifier(), for: indexPath) as? SearchItemCell {
    if indexPath.row == pointChips.count {
       cell.itemLabel.text = merchantTitle
    } else {
       cell.itemLabel.text = pointChips[indexPath.row].title
    }
    cell.delegate = self
    return cell
                
}
return UICollectionViewCell()

真实设备和模拟器之间的结果有何不同?如何在真实设备上修复,使“匹配点:”不会写两次?

iOS Swift UITableView UIColictionView 本地化

评论


答: 暂无答案