title: Objective-c set cell accessorytype based on cell text? iOS SDK
body: <p>I have a dynamic table view with 2 section, and 4 rows in each which are populated by arrays.</p>
  
  <p>Only one cell should be checked, at the moment none are.</p>
  
  <p>I know the text for the cell I want checked.</p>
  
  <p>So my question is, can I set the accessoryType for a cell based on the text that cell contains?</p>
  
  <p>Like IF cell.textLabel.text equals THIS then set that cell accessoryType check.</p>
  
  <p>Any help would be great.</p>
  
  <h2>EDIT EDIT EDIT EDIT</h2>
  
  <p>The code I have so far, taking into account comments below is this:</p>
  
  <pre><code>  switch (indexPath.section) {
          case standardSection:
              serverLoc.textLabel.text = [self.serverSelection objectAtIndex:indexPath.row];
              if ([[self.serverSelection objectAtIndex:indexPath.row] rangeOfString:cellValue].location != NSNotFound) {
                  serverLoc.accessoryType = UITableViewCellAccessoryCheckmark;
              }
              break;
          case qualitySection:
              serverLoc.textLabel.text = [self.qServerSelection objectAtIndex:indexPath.row];
              if ([[self.qServerSelection objectAtIndex:indexPath.row] rangeOfString:cellValue].location != NSNotFound) {
                  serverLoc.accessoryType = UITableViewCellAccessoryCheckmark;
              }
              break;
          default:
              break;
      }
  </code></pre>
  
  <p>The sections set them selves up like this:</p>
  
  <p>Section 1:</p>
  
  <p>Chicago, IL
  London, UK
  San Jose, CA
  Washington, DC</p>
  
  <p>Section 2:</p>
  
  <p>Chicago, IL (Q)
  London, UK (Q)
  San Jose, CA (Q)
  Washington, DC (Q)</p>
  
  <p>As you can see I'm checking against the value of CellValue. CellValue is set using a delegate from the previous view. </p>
  
  <p>Let's say this time is equals London, UK. When I come into this view both London, UK and London, UK (Q) are checked, I only want the one without (Q) checked. Even using "isEqualToString" this occurred. If cellValue equals London, UK (Q) then this works.</p>