简体   繁体   中英

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

I got a strange issue with iOS app as I'm upgrade some of the code for iOS 15

this issue is only happening to one text line “Setting” in the list

this is code I'm using

- (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

all seems fine apart from one “Settings” text is keep disappear when I click any list of it. I have tested it on ios14 and lower and it seems all fine apart from ios15 and missing “Settings”

Please see Screenshot Gif below

在此处输入图片说明

We reused this code to the already allocated UI elements which are same.

In our case, the list of options are same ui, so to improve performance we are using this coding practice to not allocate more memory to the same UI elements.

But somehow this reusable practice didn't work well on IOS 15 to drop this idea of reusable UI elements and allocate free memory for each UI list element and it worked

- (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

It's not good coding practice, but it's fine. The list of UI elements fixed. When the list is dynamic like search results, this reusable coding practice is useful cos of many lists.

Account setting options fixed and not required reusable elements. I believe that it's some kind of ios 15 issue and in future release it will fix. Like in ios 15.1 maybe?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM