【发布时间】:2013-02-04 06:28:03
【问题描述】:
我在UITableview 的cuttom 单元格中显示一个按钮。不需要时如何隐藏该按钮。例如:我在按钮上显示接收到的图像计数。如果计数为零,我需要从单元格中隐藏该按钮。
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];
}
【问题讨论】:
-
if([received_images Length] >0){ 显示你想显示的内容}
-
@user2003416 :不要在 customcell.m 中执行操作,而是将此条件放在使用 customcell 的类中。
标签: iphone xcode custom-cell