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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:31:00+00:00 2026-06-13T17:31:00+00:00

I want to change a UIButton programmatically, is that possible? Without any interaction. Can

  • 0

I want to change a UIButton programmatically, is that possible?
Without any interaction.

Can I get the objects in the view somehow? If I can get them I can iterate through them and get the UIButton I want and change it to what I want to.

  • 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-13T17:31:01+00:00Added an answer on June 13, 2026 at 5:31 pm

    Yes, this is possible.

    If you’re dealing with a dynamic number of buttons, then using tags is what you need.
    When inserting your UIButton (either via Interface Builder or programatically), you can assign it a tag. As in, view.tag = 6. This means you can pull out a particular instance of your button from it’s super view.

    In practise, you would typically add your button via:

    UIButton* btn = [UIButton alloc] initWithFrame:...];
    ....
    [self.view addSubview:btn];
    

    The additional step is assigning a tag (how you keep track of your tags is up to you).

    btn.tag = 44;
    

    In order to access it again, I can extract it from my view.

    UIButton* btn = (UIButton*)[self.view viewWithTag:44];
    

    And this produces the same instance that I initially created.

    If you wanted to replace it, you simply remove the old one, and create+add the new one.

    [btn removeFromSuperview];
    UIButton* btn2 = [UIButton alloc] initWithFrame:...];
    ...
    [self.view addSubview:btn2];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ive added buttons to my view programmatically and i want to later on change
I have 10 UIButton s that I want to change the background color of.
I want to change the background color of a textbox as an indicator that
I am creating buttons programmatically. I want to change button background color while touching
I want to change UIButton color from brown color to darkbrown color. How i
For UIButton i was using first UIButtonTypeCustom now i want to change it to
I want to change the image in image view on button click but it
I'm using this to define a grid of buttons. I want to programmatically change
I want to set text field , uibutton, label and image view at the
I have a UISegmentedControl that has six segments, I want them to call a

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.