我有 iphone 应用程序,我在其中向单元格添加按钮,当我单击该按钮时,它应该在按钮操作中为我提供该按钮的标题。
if (tableView==groupTableView) {
GroupData*theData=[groupArray objectAtIndex:indexPath.row];
cell.textLabel.font=[UIFont fontWithName:@"Helvetica" size:16];
cell.textLabel.text=theData.GroupTitle;
addButton = [UIButton buttonWithType:UIButtonTypeCustom];
//[tab1 setFrame:CGRectMake(-1,2,293,58)];
addButton.Frame=CGRectMake(400,2,42,42);
[addButton setTitle:@"Record Video" forState:UIControlStateNormal];
[addButton addTarget:self action:@selector(tab1Action) forControlEvents:UIControlEventTouchUpInside];
[addButton setImage:[UIImage imageNamed:@"popuptab1j.png"] forState:UIControlStateNormal];
addButton.clipsToBounds=YES;
[cell addSubview:addButton];
return cell;
}
-(void)tab1Action {
NSLog(@"Cell Tab1 Clicked %@",clicked);
}
当我单击此添加按钮时,它显示所选按钮的组标题,然后显示单击按钮的单元格的组标题。