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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:43:26+00:00 2026-05-23T04:43:26+00:00

How can i access a button which is present in a view ,from any

  • 0

How can i access a button which is present in a view ,from any other view.Let me elaborate i have two view controller A and B.in view A i have a button inside table view say button1 .I want to access that button inside the table view from my other view.Please help.I tried creating an object of class A and then write [objA.tableview button1 then i set image ] but it hasnt worked .Please help. Any help will be appreciated.

Thanks,
Christy

  • 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-23T04:43:28+00:00Added an answer on May 23, 2026 at 4:43 am

    You can try this give a tag to your button (make sure it is unique).

    Let say your button has tag 45; and you have made it in your table view.

    Now in another method you want to use your that button like this:-

    -(void)deletePostMethod
    {
        UIButton *button=(UIButton *)[self.view viewWithTag:49];
        [button setBackgroundColor:[UIColor redColor]];
        NSLog(@"button=%@",button);
    }
    

    Edited Answer:-

    - (UITableViewCell *)tableView:(UITableView *)tablefirst cellForRowAtIndexPath:(NSIndexPath *)indexPath {
        // I  have added a button in my table view in first row
        if (indexPath.row==0) {
            UIButton *btn=[UIButton buttonWithType:UIButtonTypeCustom];
            [btn setFrame:CGRectMake(0, 0, 40, 30)];
            [btn addTarget:self action:@selector(deletePostMethod) forControlEvents:UIControlEventTouchUpInside];
            btn.tag=579;
            [cell.contentView addSubview:btn];
        }
            return cell;
    }
    

    On that button click method

    -(void)deletePostMethod
    {
        UIButton *button=(UIButton *)[self.view viewWithTag:579];
        [button setBackgroundColor:[UIColor redColor]];
        NSLog(@"button=%@",button);
    }
    

    After clicking this button button background color set to red.

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

Sidebar

Related Questions

In a view controller i have a button which internally calls an IBAction and
Is there any way i can access the page object from within the global.asax
I have a jsfiddle application which you can access here . Now when you
I have created a custom button called ModuleUIButton which inherits from UIButton . This
I have an edit button which appears on the page when users have access
I can access the database either from a .NET program (using ODBC) or through
I can access and show self.view and see the frame in the log but
Can anyone let me know how can access an element of a list that
I know you can access the Contact Store from the SDk, but is it
I have an application you can access here When you open the app, please

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.