title: UITableView Change the cell style
body: <p>I have 2 table views I want to customise the cell  style of the second view depending on the selected row in the first table view. it works when in customising the accessories but it does't for the style. am using iOS 7.1 and Xcode 5.1
  as i using the following code</p>
  
  <p>thanks in advance </p>
  
  <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
       static NSString *TableIdentifier = @"Cell";
  
      UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:TableIdentifier];
  
      if (cell == nil) {
          cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:TableIdentifier];
      }
  
      cell.detailTextLabel.textColor = [UIColor lightGrayColor];
      cell.textLabel.text = [array objectAtIndex:indexPath.row];
  
      if ([selectedRow isEqualToString:@"Cars"]) {
          [cell setAccessoryType: UITableViewCellAccessoryDetailButton];
  
      }
      if ([selectedRow isEqualToString:@"Houses"]) {
         NSArray *temp = [[dic objectForKey:selectedRow]valueForKey:@"Job"];
  
          cell.selectionStyle = UITableViewCellStyleSubtitle;
          cell.detailTextLabel.adjustsFontSizeToFitWidth = YES;
          cell.detailTextLabel.text = [temp objectAtIndex:indexPath.row];             
      }
      if ([selectedRow isEqualToString:@"Libraries"]) {
          cell.selectionStyle = UITableViewCellStyleValue1;
      }
  
      return cell;
  }
  </code></pre>