title: When I use IOS UICollectionView , I want to add additional UIView over the cell
body: <p>Hi I am writing the codes for IPhone, So I am using UICollectionView and I want to add more customized UIView over the cell. but I think cell is called many times so the total view is odd like this.</p>
  
  <p>[the result of the cell][1]</p>
  
  <p>See, the small box is the customized  UIView but the colors are different each cell. because when UICollectionView takes the cell, it calls cell many times so the customized UIView draw box many times , its color gets thicker and thicker.</p>
  
  <p>Here is the brief code for the cell. I had so many try. but every time I failed. </p>
  
  <pre><code>- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
      DumpItForIOSReusableCollectionViewCell * cell = (DumpItForIOSReusableCollectionViewCell *)[collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier forIndexPath:indexPath];
      NSString *cellObjKey = [NSString stringWithFormat:@"%d", (unsigned int)indexPath.row];
      NSString *strFlot = (NSString *)([ko objectForKey:cellObjKey]);
      CGFloat curCont = (CGFloat)[strFlot  floatValue];
      [[cell innerUIView] setParentObj:parentObj];
      [cell imageViewHeightLayoutConstraint].constant =  curCont;
      [[cell innerUIView] setCellIndex:indexPath.row];
      [[cell innerUIView] setHeightDictionary:[self dataList]];
  
  
      NSString *itemNm = ((DumpItForIOSItemObject *)[_dataList objectAtIndex:indexPath.row]).itemTitle;
      NSString *itemDesc = ((DumpItForIOSItemObject *)[_dataList objectAtIndex:indexPath.row]).itemDescription;
  
      //NSLog(@ "cellid = %d, in = %@, x= %f, y= %f,h = %f %p" ,(unsigned int)indexPath.row,itemNm,[cell cImgView].frame.origin.x,[cell cImgView].frame.origin.y,curCont,[cell innerUIView]);
  
      [[cell cImgView] setImage:[UIImage imageNamed:((DumpItForIOSItemObject *)[_dataList objectAtIndex:indexPath.row]).itemImage]];
      [[cell cLabel] setText:itemNm];
      [[cell cmLabel] setText:((DumpItForIOSItemObject *)[_dataList objectAtIndex:indexPath.row]).itemDescription];
      NSString *checkId = ((DumpItForIOSItemObject *)[_dataList objectAtIndex:indexPath.row]).itemImageViewContainerKey;
  
       @synchronized (cell) {
  
              PriceView *pv = (PriceView *)([avs objectForKey:cellObjKey]);
              if(!pv){
                  pv = [[PriceView alloc]init];
                  [pv setOpaque:NO];
                  [pv setFrame:CGRectMake(0, 0, 100, 100)];
                  [avs setObject:pv forKey:cellObjKey];
                  [[cell cImgView] addSubview:pv];
              }else{
  
              }//if
              //[pv removeFromSuperview];
  
              NSArray *viewsToRemove = [cell subviews];
              for (NSObject *v in viewsToRemove) {
                  if([v isKindOfClass:[PriceView class]]) [(PriceView *)v removeFromSuperview];
              }//for
  
              [pv setCalledNumber:0];
              [[cell cImgView] addSubview:pv];
          }
  
      return cell;
  }
  </code></pre>
  
  <p>Is there any Idea for just adding the sub view just once?
  Thanks in advance. </p>
  
  <p>============I've solved the problem in a different way===========</p>
  
  <p>[the solved result]</p>
  
  <p>!<a href="https://i.stack.imgur.com/klSTi.png" rel="nofollow noreferrer">https://i.stack.imgur.com/klSTi.png</a></p>