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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:50:28+00:00 2026-05-23T12:50:28+00:00

I have been trying to find out the problem to this for a day

  • 0

I have been trying to find out the problem to this for a day now, and can’t seem to find the fix.

int person;



-(IBAction)personOne:(id)sender{
[twoPerson stopAnimating];
[fourPerson stopAnimating];
[threePerson stopAnimating];
[onePerson startAnimating];

person = 1;

}

-(IBAction)personTwo:(id)sender{
[threePerson stopAnimating];
[fourPerson stopAnimating];
[onePerson startAnimating];
[twoPerson startAnimating]; 

person = 2;
}
-(IBAction)personThree:(id)sender{
[fourPerson stopAnimating];
[onePerson startAnimating];
[twoPerson startAnimating];
[threePerson startAnimating];

person = 3;
}
-(IBAction)personFour:(id)sender{
[onePerson startAnimating];
[twoPerson startAnimating];
[threePerson startAnimating];
[fourPerson startAnimating];

person = 4;
}

What I’m trying to do is if this button is clicked then Person is equal to an integer value.

I don’t see a problem with this code at all.

I then have another button that’s using if statements.

-(IBAction)go:(id)sender{
ammountDueFloat = ([ammountDue.text floatValue]);
tipPercent1;
findAmmount = tipPercent1 * ammountDueFloat;
NSString *showAmmountText = [[NSString alloc]initWithFormat:@"$%.2f", findAmmount];
showammount.text = showAmmountText;



if (person = 1) {
    showPerPerson = findAmmount / 1;
    perPersonLabel.text = [[NSString alloc]initWithFormat:@"$%.2f",       showPerPerson];
}
if (person = 2) {
    showPerPerson = findAmmount / 2;
    perPersonLabel.text = [[NSString alloc]initWithFormat:@"$%.2f", showPerPerson];
}
if (person = 3) {
    showPerPerson = findAmmount / 3;
    perPersonLabel.text = [[NSString alloc]initWithFormat:@"$%.2f", showPerPerson];
}
if (person = 4) {
    showPerPerson = findAmmount / 4;
    perPersonLabel.text = [[NSString alloc]initWithFormat:@"$%.2f", showPerPerson];
}
else {
    showPerPerson = findAmmount / 1;
    perPersonLabel.text = [[NSString alloc]initWithFormat:@"$%.2f", showPerPerson];
}

}

Whenever I click the button ‘go’ it always assumes the value of person is the last if statement.

Any ideas?

  • 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-23T12:50:28+00:00Added an answer on May 23, 2026 at 12:50 pm

    use == to compare

    if(person == 1)
    {
    //...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to work out the bug on this but can't seem
I have been trying to figure out this problem for a while now and
Been trying to figure this one out all day. I have a large text
I've been trying to figure this out but can't find any answers to my
I've been trying to figure out this problem. I have an assignment to make
I have been trying to find out why the following lines of code do
I have been trying to find out what the difference is between the IS
I have been trying to find some resource on this topic for a while
I have been trying desperately to fix this issue where my ListView items are
I've been trying to find what the problem is to this following code part.

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.