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 8309493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:08:09+00:00 2026-06-08T19:08:09+00:00

I am displaying tableview from custom cell and its working fine. But the problem

  • 0

I am displaying tableview from custom cell and its working fine.
But the problem is that UiButton that is created inside tableCell not responding to selector.

I swipe the Row for Editing Then I create UIButton in titleForDeleteConfirmationButtonForRowAtIndexPath .
That appears same time when Delete button, touching Delete button responds to commitEditingStyle: Then Delete Button and Add button Disappers. Again I swipe the Row then Add & Delete Button Appear If I Click on Add Button It always Responds to canEditRowAtIndexPath then didEndEditingRowAtIndexPath.

I can’t figure out why it’s not calling btnMethod. Please let me know how to make it that btnMethod can called from uibutton touchDown event.

Here is My Code:

- (void)tableView:(UITableView *)tableView1 commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) 
{
    UITableViewCell *cell11=[tableView1 cellForRowAtIndexPath:indexPath];

    UIButton *btn=(UIButton*)[cell11.contentView viewWithTag:indexPath.row+433];


    btn.hidden=YES;

    [btn removeFromSuperview];
}    
}


 - (void)tableView:(UITableView *)tableView1 didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

}

- (NSString *)tableView:(UITableView *)tableView1 titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell11=[tableView1 cellForRowAtIndexPath:indexPath];
UIButton *btnAdd=[UIButton buttonWithType:UIButtonTypeCustom];
btnAdd.frame=CGRectMake(8, 6, 80, 30);
[btnAdd setTitle:@"Add" forState:UIControlStateNormal];
btnAdd.backgroundColor=[UIColor magentaColor];
btnAdd.titleLabel.textAlignment=UITextAlignmentCenter;
btnAdd.titleLabel.textColor=[UIColor whiteColor];
btnAdd.layer.masksToBounds=YES;
btnAdd.layer.cornerRadius=6.0;
btnAdd.layer.borderWidth=2.0;
btnAdd.layer.borderColor=[UIColor blackColor].CGColor;
btnAdd.tag=indexPath.row+433;
[btnAdd addTarget:self action:@selector(btnMethod:) forControlEvents:UIControlEventTouchUpInside];
btnAdd.userInteractionEnabled=YES;
[cell11.contentView addSubview:btnAdd];
return @"Drop Me";
}
 - (BOOL)tableView:(UITableView *)tableView1 canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
return YES;
}
- (void)tableView:(UITableView*)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath
{

}
- (void)tableView:(UITableView*)tableView1 didEndEditingRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell11=[tableView1 cellForRowAtIndexPath:indexPath];
UIButton *btn=(UIButton*)[cell11.contentView viewWithTag:indexPath.row+433];
btn.hidden=YES;
[btn removeFromSuperview];

}
-(void)btnMethod:(id)sender
{
UITableViewCell *cell=(UITableViewCell*)[sender superview];

}
  • 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-08T19:08:11+00:00Added an answer on June 8, 2026 at 7:08 pm

    I have created sample application. Its worked fine for me using your above code.

    Two suggestion from my side

    1: use [cell.contentView bringSubviewToFront:btnAdd];

    Second suggestion will be a worst case

    2: Try with GustureRecognizers

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have created a custom tableview cell in which i am displaying the values
I have an iPhone app, where I'm displaying a tableview, that's loaded from an
In a tableview I'm displaying local soccer matches from an NSMutableArray that are planned
I am getting data from json. It is working OK but the problem is
I am working on an iPad application, displaying TableView listing according to returned data
I am displaying an image in tableview cell (Image name saved in a plist).
I have difficulties displaying objects coming from CoreData in a tableView. I have 2
I have used TableView and i am displaying Data coming from the Web.NOW I
Hello I am taking records from core data entity and displaying it in tableview.
I'm working on xmlparser and displaying the data from [this xml] to a mytableview.

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.