2013-03-23 74 views
0

我正在实现一个抽屉单元。我现在使用我想要的一些自定义按钮进行配置。不幸的是,按钮没有显示。为什么我的按钮不显示在我的子视图中?

感谢您的帮助

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
    { 
     static NSString *CellIdentifier = @"Cell"; 
     HHPanningTableViewCell *cell = (HHPanningTableViewCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
     NSInteger directionMask = indexPath.row % 5; 
     if (cell == nil) { 
      NSLog(@"Cell = nil."); 
      cell = [[HHPanningTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; 




      UIView *drawerView = [[UIView alloc] initWithFrame:cell.frame]; 

      drawerView.backgroundColor = [UIColor greenColor]; 
      cell.drawerView = drawerView; 
       UIImage *checkImage = [UIImage imageNamed:@"check.png"]; 
       UIButton *checkButton = [UIButton buttonWithType:UIButtonTypeCustom]; 
       [checkButton setImage:checkImage forState:UIControlStateNormal]; 
       [drawerView addSubview:checkButton]; 


       //[checkButton addTarget:nil action:(deleteListItem:) forControlEvents:UIControlEventTouchUpInside]; 



     // Configure the cell... 

    } 

回答

2

,你说cell.frame的一部分,我相信。试试CGRectMake(0, 0, cell.frame.size.width, cell.frame.size.height)。我也看不到你给框架的按钮? checkbutton.frame = CGRectMake(...);

0

您从未为您的按钮设置框架

相关问题