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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:11:47+00:00 2026-05-22T18:11:47+00:00

i would like to build a custom table view cell and put in him

  • 0

i would like to build a custom table view cell and put in him a button and when the user click the button to go to a method-and the method will know which cell the button was pressed.

thx

  • 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-05-22T18:11:48+00:00Added an answer on May 22, 2026 at 6:11 pm

    You can give the button a tag. If you set this tag to be the number of the cells indexPath.row you can always determine from which cell the button was clicked by retrieving the tag Value.

    Button tag has to be an integer btw, but sow is indexPath.row.

    // Customize the appearance of table view cells.
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
        Huis *h = [woningen objectAtIndex:indexPath.row];
        static NSString *identifier = @"Woning";
        WoningTableCell *cell = (WoningTableCell *)[tableView dequeueReusableCellWithIdentifier:identifier];
        if (cell == nil) {
            cell = [[[WoningTableCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier] autorelease];
        }
        [cell setNewWoning:h withIndex:indexPath.row];
        return cell;
    }
    

    Here I create a custom cell displaying details of a ‘Huis’. When setting the object for the cell I also pass the indexPath.row of the cell that I am filling.

    Then in the custom cell, upon setting the object, I also set the tag value for my button like this:

    UIButton *indexBtn = [UIButton .... ];
    indexBtn.tag = indexRowInteger;
    

    The button might have already been created / initialized, in that case you only set the tag. Now in the function handling your ControlEvent you can access this tag like so:

    - (void) CellButtonPressed: (id) sender{
    
    UIButton *b = ((UIButton *)sender);
    NSInteger tagValue = btn.tag;
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to build an application that will run on a web, this
I'm trying to build Custom Membership Provider. I would like to capture additional information
I would like to create a custom Button component with three labels: left-, center-,
I’ve built a custom Maven2 plug-in using Ant. I would like to call another
I would like to build a regexp in Java that would be passed in
Basically, I would like to build a list comprehension over the cartesian product of
Inspired by Eric Sink's interview on the stackoverflow podcast I would like to build
I would like to do remote deployment from my build machine onto a server.
I would like to ask you which automated build environment you consider better, based
I would like to implement a post build event that performs the following actions

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.