Note that there are some explanatory texts on larger screens.

plurals
  1. POCheckmark won't show in TableViewCell on iOS7
    text
    copied!<p>I'm working on a weird issue right now. My Apps Deployment Target is set to iOS6, so I want to support both iOS6 and iOS7.</p> <p>I just have a simple UITableView, in which the user can select the preferred notification sound.</p> <p>The code for <code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath</code> is:</p> <pre class="lang-m prettyprint-override"><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"CheckmarkCell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; [cell setTintColor:[UIColor redColor]]; if (indexPath.section == 0){ cell.textLabel.text = [_availableSounds objectAtIndex:indexPath.row]; if (indexPath.row == _checkedSoundIndexPath.row) { cell.accessoryType = UITableViewCellAccessoryCheckmark; } } else { // Unrelated, another settings cell cell.accessoryType = UITableViewCellAccessoryNone; cell.selectionStyle = UITableViewCellSelectionStyleNone; } return cell; } </code></pre> <p>My <code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath</code> looks like the following:</p> <pre class="lang-m prettyprint-override"><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.section != 0) { return; } [self.tableView deselectRowAtIndexPath:indexPath animated:YES]; [[self.tableView cellForRowAtIndexPath:indexPath] setAccessoryType:UITableViewCellAccessoryCheckmark]; if (_checkedSoundIndexPath != indexPath) { [[self.tableView cellForRowAtIndexPath:_checkedSoundIndexPath] setAccessoryType:UITableViewCellAccessoryNone]; } _checkedSoundIndexPath = indexPath; } </code></pre> <p>The problem is that an iOS7 iPhone won't show the checkmark as expected. Running the same code on an iOS6 iPhone works as expected. I tried to insert <code>[cell setTintColor:[UIColor redColor]];</code> but without any luck. Even if I remove all AccessoryType related code and add the checkmark in my storyboard nothing appears. See screenshots below (first is iOS6 and second is iOS5).</p> <p>Does anyone have an idea ? Or is it a bug in iOS7 ?</p> <p>Thanks in advance !</p> <p><strong>Edit:</strong></p> <p>Even if I make a new simple UITableViewController, with just 5 cells with the Accessory set to UITableViewAccessoryTypeCheckmark, the Checkmarks won't appear on iOS7.</p> <p><img src="https://i.stack.imgur.com/HY5Qr.png" alt="iOS6 on an iPhone 4"> <img src="https://i.stack.imgur.com/dWLvg.png" alt="iOS7 on an iPhone 5"></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload