objective-cuitableviewuiimageviewuibuttonxcode6.0.1

Apply check on tableViewCells to hide imageView


In my tableView, I have 5 tableView cells. Each has an imageView. Outside tableView, there's a UIButton. UIButton also has image on it. Now, my issue is to check if the image on cells is hidden or not. Clearing the issue, I need to check for all the cells that if imageView on all the cells is hidden or not. I tried this code :

 for (int i=0; i<=4; i++) 
    {
     if (cell.unlockImageView.hidden)
     {
        NSLog(@"calling if for hiding image");
      }
    }

I don't think my code is correct but I gave it a try and it didn't work. So please suggest me how to check that imageView on all cells is hidden or not?


Solution

  • Try the below code hope it can help you.

    for (customTableViewCell* tblCell in tableView.visibleCells)
        {
            if (tblCell.unlockImageView.hidden)
            {
                NSLog(@"Imageview is hidden");
            }
        }