0

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?

ThatGuy
  • 3
  • 3
  • 1
    If you're just starting out, asking questions on Stack Overflow is not the place you need to be. You should find a good book or a series of online tutorials. Have a look at [Good resources for learning ObjC](http://stackoverflow.com/q/1374660). The Big Nerd Ranch books are excellent, and lots of people like the Stanford iOS course on iTunes U. Good luck! – jscs Feb 15 '14 at 21:22
  • @JoshCaswell Thank you for your response. I will look forward into getting a more stable environment for learning. – ThatGuy Feb 15 '14 at 21:27
  • Anyone who is looking at my question, I am still looking for an answer, thank you. – ThatGuy Feb 15 '14 at 22:29

1 Answers1

-1

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.

Nick
  • 939
  • 1
  • 12
  • 19