I am displaying a button in cutstom cell in UITableview. How do I hide that button when it is not needed. For example: I am display received images count on button. In case count will be zero, I need to hide that button from cell.
contactviewController.m
if (![[arr objectAtIndex:4] isEqualToString:@"0"]) {
[cell1 setImg:[arr objectAtIndex:4]];
}
Customcell.m
-(void)setImg:(NSString *)_text
{
imgView.titleLabel.textColor = [UIColor whiteColor];
[imgView setTitle:_text forState:UIControlStateNormal];
}
Create UITableViewCell.h and .m file.
Create some variable like UILabel and UIImageView object in files and make it IBOutlet and bind them with cell .xib file.
Inside UITableView implementation, and in “cellForRowAtIndexPath” you can use that custom UITableViewCell class object and use that synthesize variable of UILable and UIImageView and use it to show or hide accordingly.