I am creating custom button in table view
and in the action of that button I want to print index path
of particular row. I am calling the method by selectors.
Code:
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *cellIdentifier=@"";
UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if(!cell)
{
cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
// cell.textLabel.text=@"Hello";
UIImageView *img=[[UIImageView alloc]initWithFrame:CGRectMake(cell.contentView.frame.size.width/2, cell.contentView.frame.size.height/2-10, 20, 30)];
UIButton *btn=[[UIButton alloc]initWithFrame:CGRectMake(cell.contentView.frame.size.width-20, 0, 20, cell.contentView.frame.size.height-20)];
[btn setBackgroundImage:[UIImage imageNamed:@"band"] forState:UIControlStateNormal];
[ btn addTarget:self action:@selector(change:) forControlEvents:UIControlEventTouchUpInside ];
[cell.contentView addSubview:btn];
[cell.contentView addSubview:img];
img.image=[UIImage imageNamed:@"band"];
}
return cell;
}
-(void)change:(NSIndexPath *)idd
{
NSLog(@"%@",idd);
}
Problem: How can I pass parameters NSIndexPath
in selectors?