我试图找到UITableViewCell
如下选择:
- (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];
}
if ([indexPath row] == [tableView cellForRowAtIndexPath:indexPath.row]) // i want to place value of selected row to populate the buttons
//([indexPath row] == 0)
//(indexPath.row == ![self cellIsSelected:indexPath])
{
UIButton *AddComment = [UIButton buttonWithType:UIButtonTypeCustom]; // custom means transparent it takes shape same with backgroup image
[AddComment addTarget:self
action:@selector(TestBtns:)
forControlEvents:UIControlEventTouchDown];
// [AddComment setTitle:@"1" forState:UIControlStateNormal];
AddComment.frame = CGRectMake(9.0, 128.0, 96.0, 26.0);
[cell.contentView addSubview:AddComment];
UIImage *buttonAddComment = [UIImage imageNamed:@"addcomment.png"];
[AddComment setBackgroundImage:buttonAddComment forState:UIControlStateNormal];
[cell.contentView addSubview:AddComment];
}
如何实现这一点,请您指导我,我在哪里做错了。