簡體   English   中英

iOS15,每次單擊另一個列表的文本時,文本之間的鏈接都會消失

[英]iOS15, link between text is disappear every time when I click on another list’s text

我在升級 iOS 15 的一些代碼時遇到了一個關於 iOS 應用的奇怪問題

此問題僅發生在列表中的一個文本行“設置”中

這是我正在使用的代碼

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    FLTAccountTVCell *cell = [tableView dequeueReusableCellWithIdentifier:kFLTAccountTVCellReuseId];

    if (!cell) {
        cell = [[FLTAccountTVCell alloc] initWithReuseIdentifier:kFLTAccountTVCellReuseId];
        cell.textLabel.font = [FLTStylesheet regularFontWithSize:kFontSizeMedium];
    }

    cell.textLabel.text = [self titleForCellAtIndexPath:indexPath];
    return cell;
}

FLTAccountTVCell 是 UITableViewCell 的子類

除了一個“設置”文本之外,一切似乎都很好,當我單擊它的任何列表時,它會一直消失。 我已經在 ios14 及更低版本上對其進行了測試,除了 ios15 和缺少“設置”之外,它似乎一切都很好

請參閱下面的截圖 Gif

在此處輸入圖片說明

我們將此代碼重用於已分配的相同 UI 元素。

在我們的例子中,選項列表是相同的 ui,所以為了提高性能,我們使用這種編碼實踐來不為相同的 UI 元素分配更多的內存。

但不知何故,這種可重用的做法在 IOS 15 上效果不佳,放棄了可重用 UI 元素的想法,並為每個 UI 列表元素分配了可用內存,但它奏效了

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    FLTAccountTVCell *cell = [tableView dequeueReusableCellWithIdentifier:kFLTAccountTVCellReuseId];

    if (!cell) {
        cell = [[FLTAccountTVCell alloc] initWithReuseIdentifier:kFLTAccountTVCellReuseId];
        cell.textLabel.font = [FLTStylesheet regularFontWithSize:kFontSizeMedium];
    }

    cell.textLabel.text = [self titleForCellAtIndexPath:indexPath];
    return cell;
}
FLTAccountTVCell is subclass of UITableViewCell

這不是一個好的編碼習慣,但它很好。 修復了 UI 元素列表。 當列表像搜索結果一樣是動態的時,這種可重用的編碼實踐對於許多列表來說都是有用的。

帳戶設置選項已修復,不需要可重復使用的元素。 我相信這是某種 ios 15 問題,在未來的版本中它會修復。 就像在 ios 15.1 中一樣?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM