how to hide custom UIButton in uitableviewcell?
I am using a custom UItablecell for rows in one of my uitableviews. However, the customtabelcell has a UIButton that I would like to hide in the UItableview display. The custom tablecell was designed in IB. I tried the following code but it doesn't seem to hide the 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"
开发者_如何学Python 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;
}
Does anyone have some idea as to what to do?
Thanks
Are you sure you set the button outlet in IB?
精彩评论