我在我的一个uitableviews中使用自定义UItablecell作为行。但是,customtabelcell有一个UIButton,我想在UItableview显示中隐藏它。自定义tablecell是在IB中设计的。我尝试了以下代码但它似乎没有隐藏uibutton:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == 0)
{
static NSString *cellIdentifier = @"customTableCell1";
customTableCell1* myOrderCell1 = (customTableCell1*)[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (myOrderCell1 == nil)
{
NSLog(@"Cell created");
NSArray *nibObjects = [[NSBundle mainBundle] loadNibNamed:@"customTableCell1"
owner:nil
options:nil];
for(id currentObj in nibObjects)
{
if ([currentObj isKindOfClass:[customTableCell1 class]] )
{
myOrderCell1 = (customTableCell1 *)currentObj;
}
}
}
myOrderCell1.backgroundColor = [UIColor blackColor];
myOrderCell1.accessoryType = UITableViewCellAccessoryNone;
**myOrderCell1.AddToCartBtn.hidden = YES;
myOrderCell1.AddToCartBtn.enabled = NO**;
return myOrderCell1;
}
有没有人知道该怎么做?
由于
答案 0 :(得分:0)
您确定在IB中设置按钮插座吗?