title: How do you load custom UITableViewCells from Xib files in ios
body: <p>Hi i am very beginner in iOS and in my <code>UITableView</code> I am loading <code>UITableViewCell</code> from Xib using below code but UIFields are not fitting perfectly as like my below screen please help me why fields are not fitting perfectly?</p>
  
  <h2>my code:-</h2>
  
  <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
      static NSString *simpleTableIdentifier = @"MyCell";
      DetailsTableViewCell *cell = (DetailsTableViewCell *)[MaintableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
      if (cell == nil)
      {
          NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"DetailsTableViewCell" owner:self options:nil];
          cell = [nib objectAtIndex:0];
      }
      return cell;
  }
  
  - (CGFloat)tableView:(UITableView *)aTableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
      return 100;
  }
  
  - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *) cell forRowAtIndexPath:(NSIndexPath *)indexPath{
      cell.contentView.backgroundColor = [Bg colorWithHexString:@"FFB848"];
      UIView * whiteRoundedView = [[UIView alloc]initWithFrame:CGRectMake(0, 10, self.view.frame.size.width, 70)];
      whiteRoundedView.layer.backgroundColor = [Bg colorWithHexString:@"EF4836"].CGColor;
      whiteRoundedView.layer.masksToBounds = NO;
      whiteRoundedView.layer.cornerRadius = 0.0;
      whiteRoundedView.layer.shadowOffset = CGSizeMake(-1, -1);
      [cell.contentView addSubview:whiteRoundedView];
      [cell.contentView sendSubviewToBack:whiteRoundedView];
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Uwykk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Uwykk.png" alt="enter image description here"></a></p>