title: Center label in UITableViewCell
body: <p>i'm trying to programmatically center a Custom UILabel into a UITableViewCell. The problem is it does not seem to center probably. I'm using this code:</p>
  
  <pre><code>- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  {
      return 80;
  }
  
  
  - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  
  {
      chatCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
      if (cell == nil) cell = [[chatCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"];
      float yPos = (CGRectGetHeight(cell.contentView.frame) - CGRectGetHeight(cell.homeTeamLabel.frame)) / 2;
  
      cell.homeTeamLabel = [[UILabel alloc] initWithFrame:CGRectMake(22.0, yPos, 220.0, 15.0)];
      cell.homeTeamLabel.text = [items objectAtIndex:indexPath.row];
      cell.homeTeamLabel.font = [UIFont systemFontOfSize:14.0];
      cell.homeTeamLabel.textColor = [UIColor blackColor];
      [cell.contentView addSubview:cell.homeTeamLabel];
  
  
      return cell;
  }
  </code></pre>
  
  <p>And here is a picture of how it looks. As you can see its not centered. How can i center it?</p>
  
  <p><img src="https://i.stack.imgur.com/HPD0w.png" alt="enter image description here"></p>