Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8890015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:24:13+00:00 2026-06-14T22:24:13+00:00

I have a custom tableview cell which has a button. I need to pass

  • 0

I have a custom tableview cell which has a button. I need to pass the NSIndexPath object of tablview when the button is clicked. I am able to do is assign a tag to a button, receive the tag using sender..but I want to pass the NSIndexPath object…below is the code.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
 {
   static NSString *CellIdentifier = @"shortCodeCell";
   IPadTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
   if (cell == nil)
   {
        NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"KeywordsCell"     owner:nil options:nil];

        for (id currentObject in topLevelObjects)
        {   
            if ([currentObject isKindOfClass:[IPadTableViewCell class]])
            {
                cell = (IPadTableViewCell  *)currentObject;
            }
        }
    }
    // Delete
    [cell.btnDelete addTarget:self action:@selector(onDelete:) forControlEvents:UIControlEventTouchUpInside];

    cell.btnDelete.tag=indexPath.row;

    return cell;
}

-(void)onDelete:(id)sender
{   
     UIButton *btn=(UIButton *)sender;
     NSLog(@"BtnIndexpath to be deleted:%d",btn.tag);
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
     int errorCode = 0;
     kd = [items objectAtIndex:btn.tag];
     BOOL isDeleteKeyword= [ServerAPI deleteKeywordWithId:kd.keywordId :&errorCode];
     dispatch_async (dispatch_get_main_queue (),
                    ^{
                        if (isDeleteKeyword) {
                            [items removeObjectAtIndex:btn.tag];
                            //[tblKeywords deleteRowsAtIndexPaths:[NSArray arrayWithObject:btnIndexPath] withRowAnimation:YES];
                            [self.tblKeywords reloadData];
                        }
                        else return;
                    });
    });
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T22:24:14+00:00Added an answer on June 14, 2026 at 10:24 pm

    You can set the following in “cellForRowAtIndexPath”

    cell.tag = indexPath.section; 
    cell.btnDelete.tag=indexPath.row;
    

    And in “onDelete” you can create indexPath based on tags assigned.

    NSIndexPath *indexPath = [NSIndexPath indexPathForRow:[sender tag] inSection:[[sender superview] tag]]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a tableview which contains custom cells where each cell has some PDF
I have a custom tableview cell, which contains some object UIImageView, UILabel, and a
I have a custom cell which has two UILabel objects. //AppEventCell.h #import <UIKit/UIKit.h> @interface
i am having a tableview in which custom cells are loaded.Custom cell has a
I have a custom table cell which has a custom ui view in it.
I have a custom tableview cell created programmatically that consists of: a background view
i have a tableView with a custom cell, my first cell is different with
I have a tableview with custom UITableViewCells, each row in the table has a
I have a UITextField in a custom tableview cell. On tapping the textfield area
I have a custom cell for my table view which I have designed using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.