【发布时间】:2015-04-10 06:42:31
【问题描述】:
我正在尝试向我的 UITableView 单元格添加按钮,使用如下代码:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
UIButton *button = self.buttons[0];
[cell addSubview:button];
return cell;
}
该按钮没有显示。是否可以向这样的单元格添加按钮,还是我必须制作自定义 UITableViewCell 类?
当为数组制作按钮时,框架设置如下:
UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 70, 70)]
【问题讨论】:
标签: ios xcode uitableview uibutton