I'm making a quiz app for the iPhone with two labels simply showing how many questions the user answered correct/wrong. When the player presses one of the answers, the label's value goes up one point.
I have tried to make the code global, so that it's retained between the views, coding it in the AppDelegate. The thing is that the labels are empty when going to the new view/question. When one of the answers are pressed, the correct updated value is shown in the labels, but then disappear when going to a new question. What should I do?
I'm making a quiz app for the iPhone with two labels simply showing how many questions the user answered correct/wrong. When the player presses one of the answers, the label's value goes up one point.
I have tried to make the code global, so that it's retained between the views, coding it in the AppDelegate. The thing is that the labels are empty when going to the new view/question. When one of the answers are pressed, the correct updated value is shown in the labels, but then disappear when going to a new question. What should I do?
Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.
If you don't have a viewWillAppear method, search for it in the Xcode documentation. Copy the method definition into your .m file, and insert the line of code above.
You need to get a book on beginning Objective C/iOS development and do some reading. If you are as much of a noob as that, you're going to drive yourself (and us) crazy with not knowing how to do anything.
Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.