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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T19:51:08+00:00 2026-05-14T19:51:08+00:00

In my application I’m doing dynamic resizing of cells and label in it depending

  • 0

In my application I’m doing dynamic resizing of cells and label in it depending upon the text in it.
I’m adding button to cells in uitableview.

I’m taking the label instance and button instance in a new label and button variable respectively and setting their frames to arrange them properly after resizing.

     if(cel==nil)
     {
       //some code
       original_label=[[UILabel alloc]init];
       original_label.tag=111;

       //SOME MORE CODE GOES HERE

       original_button=[[UIButton alloc]init];
       original_button.tag=222;
       //SOME MORE CODE GOES HERE
     }

      new_label=(UILabel *) [cell viewWithTag:111];    //This' how I'm taking the label instance on cell and below button instance on cell in new variables
      new_button = (UIButton * ) [cell viewWithTag:222];

Earlier I kept the tags of all the buttons on cells same, so it was easier to get button instances on cells properly and were being arranged properly. But now I want to recognize these buttons separately as I’m adding some functionality on button_click. I’m giving the buttons that are added to the cells incremental tags[1,2,3…9 and so on]. Now, how can I take these button tags in some range like[suppose 1-9]?

Can anybody help?

Thanks in advance.

  • 1 1 Answer
  • 1 View
  • 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-14T19:51:09+00:00Added an answer on May 14, 2026 at 7:51 pm

    You can keep the button tags the same as you had before.

    Instead, in the button_click method, figure out which row the button is in like this:

    - (void)button_click:(UIButton *)button
    {
        UITableViewCell *cell = (UITableViewCell *)[[button superview] superview];
        NSIndexPath *indexPath = [tableView indexPathForCell:cell];
    
        //code to handle this indexPath.section and indexPath.row...
    }
    

    This assumes you have added the button to cell.contentView which is what the first superview gets. The second superview gets the cell.

    The addTarget for the button should look like this (note colon after button_click):

    [original_button addTarget:self action:@selector(button_click:) forControlEvents:UIControlEventTouchUpInside];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Our application takes text from a web form and sends it via email to
Application level events and processes in Excel are restricted to a single instance of
My application is having two activities. In first activity, I have one button and
Application: WPF Application consisting of a textbox on top and a listbox below Users
Application : HTA (therefore IE) This is an application that uses SendKeys to populate
Application is written in delphi 2010 and the underlying dll is a C++ dll.
Application[temp] = 8; should set the value 8 to the key temp . However,
Application names on Google Play don't need to be unique, and it's possible to
Application is running in my local system app.config file <add key=dbconn value=Data Source=(local);database=VTech;User ID=sa;Password=sa;
Application launch through Java web start(JWS) checks for update when we are launching it.

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.