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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:47:03+00:00 2026-05-26T11:47:03+00:00

In my program I am trying to set a value for bucket1&2 that is

  • 0

In my program I am trying to set a value for bucket1&2 that is then outputted to a label
in previous actions I am setting a value for bucket1 and bucket2, that has been outputted to a label and when I push the button “bucket1trans” I want it to use the previous values to make a new value for bucket2, then output it to a label

What I’ve done is below

int bucket1;
int bucket2;

-(IBAction)bucket1trans:(id)sender{
bucket2 = bucket2+bucket1;
label2.text = [NSString stringWithFormat:@"%d", bucket2];
}

I am not sure if I should be using int as my program doesn’t seem to remember the previous that was set for my int.

  • 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-26T11:47:04+00:00Added an answer on May 26, 2026 at 11:47 am

    the code you have shown isn’t sufficient for debugging what the problem is.
    But the general solution are:

    1) use a static variable for your bucket variables.

    For Ex:

    static int bucket1;
    static int bucket2;
    

    2) If you want to use the same value over the program, define it in the appDelegate and access it using the shared instance of the appDelegate of your program.

    <Your AppDelegate Name> *appDelegate = (<Your AppDelegate Name>*)[[UIApplication sharedApplication] delegate];
    int bucket1 = appDelegate.bucket1;
    

    In your appDelegate, you need to synthesize the variable in order to access it using . operator.

    For Example:

    in your appDelegate.h file,

    @property(nonatomic, retain) int bucket1;
    

    in your appDelegate.m

    @synthesize bucket1;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to multithread something and i have my program set up such that
In a C# WPF program I'am trying to set the value of a HTML
I'm trying to set up a Binary search program that uses strings instead of
I am trying to set the CLASSPATH variable so that my java programs can
I have a C# (WinForm) program that supports scanning using WIA. I am trying
I'm trying to build a class that stores program settings as a std::map. Since
Hello I am trying to write a program in python that asks the user
I'm trying to set up a parser which, given a value, can assign it
I am trying to set a value through reflection. I created this little test
Imagine we have a program trying to write to a particular file, but failing.

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.