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

  • Home
  • SEARCH
  • 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 8850389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:53:29+00:00 2026-06-14T12:53:29+00:00

I wanted to make a button that will flip between 2 different stages by

  • 0

I wanted to make a button that will flip between 2 different stages by changing the test. So if it says add, you click on i changes to remove. If it says remove it will change to add.

The program did not work,
to try and debug it, I put the setTitle method in oncreate, it worked there. Next I set break point in my method. It detected it said add, and executed the line that is suppose to change the text, the text did not change. I’m really don’t understand why it works on the oncreate method and not my method.

Code

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    mFeetImage.contentMode = UIViewContentModeScaleAspectFit;

    [gFileName Reset];
    NSString *ted= [gFileName GetFileName];
    mFeetImage.image= [ UIImage imageNamed :ted];

    // test code
    [ mFavrest setTitle: @"ADD" forState:UIControlStateNormal ];  works
}

-(IBAction) aFavest: (id) sender
{
    NSString *t=mFavrest.currentTitle;
    int i=[ t compare:@"ADD" ];

    if ( i ==0 )
    {
        // set break point here, break point goes off text does not change
        [ mFavrest setTitle: @"REMOVE" forState:UIControlStateNormal ];
    }
    else
    {
        [ mFavrest setTitle: @"ADD" forState:UIControlStateNormal];
    }
}
  • 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-14T12:53:30+00:00Added an answer on June 14, 2026 at 12:53 pm

    Try the following code:

    -(IBAction) aFavest: (id) sender
    {
        UIButton *youButton = (UIButton*)sender;
        if ([youButton.currentTitle isEqualToString:@"ADD"])
        {
            // set break point here, break point goes off text does not chnage
            [youButton setTitle: @"REMOVE" forState:UIControlStateNormal ];
        }
        else
        {
            [youButton setTitle: @"ADD" forState:UIControlStateNormal];
        }
    }
    

    Also, make sure the variable mFavrest is properly connected. Put a break point somewhere and check if it isnt nil.

    If the IBOutlet mFavrest is connected properly and the IBAction is as well, this code should work.

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

Sidebar

Related Questions

i wanted to make the button such that if button A is click, A
I wanted to make an application that will take either the path of the
I wanted to make a button which is transparent until the user hovers over
So I wanted to create a toggle-button for a table, where I can make
I wanted to make a function that populates a Grid in WPF with pictures.
I'm new in Android development and I wanted to make application that has header,
I have a button and I wanted (when click) to have a div appear
I wanted a numeric keypad that had a go or done button that closed
I wanted to make a Java based web crawler for an experiment. I heard
I wanted to make a JOptionPane.showOptionDialog with some JTextArea and JLabel . The problem

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.