我想你可以像这样配置你的单元格:
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]autorelease];
}
CGRect Frame4 = CGRectMake(10.0, 30.0, 50.0, 40.0);
UIButton *button = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
button.frame = Frame4;
[button setTitle:@"Click" forState:UIControlStateNormal];
button.backgroundColor = [UIColor grayColor];
[button addTarget:self
action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside];
[cell.contentView addSubview:button];
return cell;
}
然后添加按钮动作事件:
请为您想要的图像按钮替换“ UIButtonTypeDetailDisclosure ”