after adding uitableview to uiview didselectrowatindexpath not called ios <p>I have created a custom tableview <strong>displayCustomUnitTableView</strong> and a custom UIView <strong>displayView</strong> and adding <strong>displayCustomUnitTableView</strong> to <strong>displayView</strong>. But i am not able to select any row in the tableView i.e., <strong>didSelectRowAtIndexPath</strong> is not called.</p> <p>I am using the following code:</p> <pre><code>displayCustomUnitTableView = [[UITableView alloc]initWithFrame:CGRectMake(52.0, 110.0, 180.0, 110.0) style:UITableViewStylePlain]; displayCustomUnitTableView.delegate = self; displayCustomUnitTableView.dataSource = self; displayCustomUnitTableView.tag = 2; displayCustomUnitTableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine; displayCustomUnitTableView.separatorColor = [UIColor blackColor]; displayCustomUnitTableView.rowHeight = 30.f; [displayCustomUnitTableView setBackgroundColor:[ContentViewController colorFromHexString:@"#BCC9D1"]]; [displayCustomUnitTableView setBackgroundColor:[UIColor groupTableViewBackgroundColor]]; [displayCustomUnitTableView setAllowsSelection:YES]; [displayView addSubview:displayCustomUnitTableView]; </code></pre> <p>cellForRowAtIndexPath:</p> <pre><code>-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"MyCell"; UITableViewCell *cell= [tableView cellForRowAtIndexPath:indexPath]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } if(tableView.tag == 1) { cell.textLabel.text = [storeUnitList objectAtIndex:indexPath.row]; } else if(tableView.tag == 2) { cell.textLabel.text = [storeCustomUnitList objectAtIndex:indexPath.row]; } return cell; } </code></pre> <p>didSelectRowAtIndexPath:</p> <pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if(tableView.tag == 1) { unitString = [storeUnitList objectAtIndex:indexPath.row]; } else if(tableView.tag == 2) { unitString = [storeCustomUnitList objectAtIndex:indexPath.row]; } } </code></pre> <p>Thanks in advance.</p>