2011-04-09 58 views
0

我在我的一個uitableviews中使用自定義的UItablecell作爲行。但是,customtabelcell有一個UIButton,我想隱藏在UItableview顯示中。自定義表格是在IB中設計的。我試着下面的代碼,但它似乎並沒有隱藏的UIButton:如何隱藏uitableviewcell中的自定義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

你確定你設置在IB按鈕出路何在?

+0

是的,這是問題所在。謝謝 :) – banditKing 2011-04-09 19:29:28

相關問題