Objective c 为什么我的按钮没有显示在我的子视图中?
我正在实现一个抽屉单元。我现在正在配置一些我想要的自定义按钮。不幸的是,按钮没有显示 谢谢你的帮助Objective c 为什么我的按钮没有显示在我的子视图中?,objective-c,uibutton,Objective C,Uibutton,我正在实现一个抽屉单元。我现在正在配置一些我想要的自定义按钮。不幸的是,按钮没有显示 谢谢你的帮助 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; HHPanningTableViewCell *cell
- (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...
}
我相信你说的是
cell.frame
。尝试执行CGRectMake(0,0,cell.frame.size.width,cell.frame.size.height)
。我也没看到你给按钮加框<代码>checkbutton.frame=CGRectMake(…)代码>您从未为按钮设置边框