如果我想在视图中制作10X10按钮,简单的方法是制作100个按钮,
在Cocoa中可以使用NSButtonCell
,所以在iOS中有类似的东西吗?
答案 0 :(得分:0)
您可以创建自定义单元格
在cellForRowAtIndexPath中添加自定义tableView单元格,如下所示,
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *yourCustomeCelldentifier = @"CustomeTableCell";
yourCustomeCell *cell = (yourCustomeCell *)[tableView dequeueReusableCellWithIdentifier:yourCustomeCelldentifier];
if (cell == nil)
{
NSArray *nib;
nib = [[NSBundle mainBundle] loadNibNamed:@"CustomeCell_Nib" owner:self options:nil];
cell = [nib objectAtIndex:0];
}
return cell;
}
希望这种方式可以帮助你