Now I am working on a strange problem. My Apps Deployment Target is configured on iOS6, so I want to support both iOS6 and iOS7.
I just have a simple UITableView in which the user can select their preferred notification sound.
Code - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath :
- (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; }
My - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath looks like this:
- (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; }
The problem is that the iPhone iOS7 will not show a checkmark as expected. Running the same code on an iPhone iOS6 works as expected. I tried to insert [cell setTintColor:[UIColor redColor]]; but no luck. Even if I delete all AccessoryType code and add a checkmark in my storyboard, nothing will appear. See the screenshots below (first iOS6, and the second iOS5).
Does anyone have any ideas? Or is this a bug in iOS7?
Thanks in advance!
Edit:
Even if I create a new simple UITableViewController, only 5 cells with a set of accessories for the UITableViewAccessoryTypeCheckmark, check marks will not be displayed on iOS7.


source share