Forgive me for this question, but I am not very experienced in Objective-C. I have been trying to solve this problem for a few days, but I haven't been able to get a grasp on this problem and I need help from the experienced. I am on an endeavor in Xcode to create a simple game in which a ViewController, my first ViewController, provides a score which is on a UILabel. I have created another ViewController, my second ViewController, which I want to display the score and that is my problem. I know how to display the score on a UIAlertView, but it seemed unappealing. How do I have the same UILabel variable, which I have used %i, on two ViewControllers? I have tried to think of a few solutions to this predicament, but even if I did, I didn't know how to apply them. Can you create two labels working as one one two different ViewControllers? Can you keep it on the same ViewController such as customizing the graphics of a UIAlertView? I need help with creating solutions that are applicable. Thank You!
Example: Temple Run, Angry Birds, and all other great games tell you the score at the end of each level. How might I go about this?
First, no you can't have the same IBOutlet going to two different view controllers, as it is part of the class it is initialised in. However, displaying a score in as many view controllers as you like is possible.
The score should be part of your data model as it is something that will change over the lifecycle of game play.
The bad news however, is that there are quite a few different ways to implement this, and without actually knowing your current architecture, it is impossible to advise.
As John Caswell has suggested - you really should get a good book(s) and/or video tutorials and learn both objective-c and the cocoa touch frameworks. It sounds like you are trying to run before you can walk.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments