title: Detecting Tap on UICollectionView inside an UITableViewCell
body: <p>I am working with the <code>UICollectionView</code> inside <code>UITableViewCell</code>. I am done with adding the contents and I am able to see the <code>UICollectionView</code> inside <code>UITableViewCell</code>.</p>
  
  <p>But now I don't know how to check which <code>cell</code> of <code>UICollectionView</code> is tapped inside the which row of <code>UITableView</code>.</p>
  
  <p>So if anybody knows how to recognize it pls help.</p>
  
  <p>Thanks in advance.</p>
  
  <pre><code>#pragma mark
  #pragma mark - UITableViewDelegate and UITableViewDatasource
  -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
      return 1;
  }
  
  -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
      return 15;
  }
  
  -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
      CellForCollectionView *cell = [tableView dequeueReusableCellWithIdentifier:@"CellForCollectionView"];
  
      if (cell == nil) {
          cell = [[CellForCollectionView alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CellForCollectionView"];
      }
  
      cell.categoryCollectionView.delegate = self;
      cell.categoryCollectionView.dataSource = self;
  
      [cell.categoryCollectionView registerNib:[UINib nibWithNibName:@"CollectionCellForCategory" bundle:nil] forCellWithReuseIdentifier:@"CollectionCellForCategory"];
      cell.lblCategoryName.text = [NSString stringWithFormat:@" Category %d",indexPath.row];
  
      cell.selectionStyle = UITableViewCellSelectionStyleNone;
      return cell;
  }
  
  
  
  
  
  
  #pragma mark
  #pragma mark - UIcollectionViewDelegate and UIcollectionViewDatasource
  -(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
      return 1;
  }
  
  - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
      return 15;
  }
  
  - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
      CollectionCellForCategory *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"CollectionCellForCategory" forIndexPath:indexPath];
      cell.imagCategory.layer.borderColor = [[UIColor blackColor]CGColor];
      cell.imagCategory.layer.borderWidth = 1.0f;
      return cell;
  }
  
  
  -(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
      NSLog(@"%ld",(long)indexPath.row);
      NSLog(@"%ld",(long)indexPath.section);
  }
  </code></pre>