Ios 如何在自定义表格单元格中创建自定义按钮在每个单元格中我需要三个图像
在上面的代码中,我在每个重复的单元格中只得到了单元格的lastbutton。请告诉我如何在每个单元格中显示三个按钮,提前感谢我希望根据我的图像数组计数在表视图中显示按钮。假设我的图像数组计数为20。我希望这些图像每行有3个,就像6行一样,最后一个单元格包含2个images@user2160953编辑你的答案,因为它不清楚你到底想要什么。Ios 如何在自定义表格单元格中创建自定义按钮在每个单元格中我需要三个图像,ios,Ios,在上面的代码中,我在每个重复的单元格中只得到了单元格的lastbutton。请告诉我如何在每个单元格中显示三个按钮,提前感谢我希望根据我的图像数组计数在表视图中显示按钮。假设我的图像数组计数为20。我希望这些图像每行有3个,就像6行一样,最后一个单元格包含2个images@user2160953编辑你的答案,因为它不清楚你到底想要什么。 - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)r
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self)
{
// Initialization code
NSLog(@"Content View = %f",self.contentView.frame.size.height);
photobutton=[UIButton buttonWithType:UIButtonTypeCustom];
[self.contentView addSubview:photobutton];
}
return self;
}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self)
{
// Initialization code
NSLog(@"Content View = %f",self.contentView.frame.size.height);
photobutton=[UIButton buttonWithType:UIButtonTypeCustom];
[self.contentView addSubview:photobutton];
}
return self;
}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self)
{
btn1 = [UIButton buttonWithType:UIButtonTypeCustom];
btn1.frame = CGRectMake(0, 0, 50, 35); // set as u required.
[self.contentView addSubview:btn1];
btn2 = [UIButton buttonWithType:UIButtonTypeCustom];
btn2.frame = CGRectMake(65, 0, 50, 35); // set as u required.
[self.contentView addSubview:btn2];
btn3 = [UIButton buttonWithType:UIButtonTypeCustom];
btn3.frame = CGRectMake(120, 0, 50, 25); // set as u required.
[self.contentView addSubview:btn3];
}
return self;
}