How do you have the same IBOutlet on two different ViewControllers if possible?

ThatGuy

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?

Nick

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

How do you show a Subject with two different Predicates that point to the same Object in a linked graph?

From Java

Can you have two classes with the same name and the same member function in different translation units?

From Dev

Is it possible to have two different instances of same Eclipse version?

From Dev

how to connect two viewcontrollers to same navigationcontroller in storyboard iphone

From Dev

Same UIPickerView in different ViewControllers

From Dev

How can you have two records with the same field names?

From Dev

How do you send messages between different users of the same app?

From Dev

How do you subset a data frame that has different values for the same two columns in R

From Dev

How is it possible to have feeds from different Urls in the same ListView

From Dev

IBOutlet to two viewControllers on two storyboards... is that possible

From Dev

two codes Theoreticaly same but practicaly works different...how is it possible

From Dev

c++, is that possible to have two unions with the same name in different header files

From Dev

How do you assign an IBOutlet programmatically using Swift?

From Dev

Is it possible to have two functions with the same signature called under different contexts? (Attribute manipulation)

From Dev

How is it possible for two identical Docker images to have different packages installed?

From Dev

How do you check to see if two different file reference "strings" refer to the same file?

From Dev

How do you switch ViewControllers?

From Dev

How do they work when you have two graphic cards on Ubuntu?

From Dev

How can I do to associate a Xib to same viewcontrollers?

From Dev

how to connect two viewcontrollers to same navigationcontroller in storyboard iphone

From Dev

How do you subset a data frame that has different values for the same two columns in R

From Dev

two codes Theoreticaly same but practicaly works different...how is it possible

From Dev

How to have two different format of headings at the same “level” in a Table Of Content?

From Dev

I have viewcontrollers in a scrollview, but how do I start on a certain page?

From Dev

How to have two different intent filters for same activity?

From Dev

How do you change multiple CSS as the same time with different clicks?

From Dev

Same IBOutlet from different storyboards?

From Dev

Add same UITableView to different ViewControllers

From Dev

How do you have an ActionListener perform different events based on the actionPerformed?

Related Related

  1. 1

    How do you show a Subject with two different Predicates that point to the same Object in a linked graph?

  2. 2

    Can you have two classes with the same name and the same member function in different translation units?

  3. 3

    Is it possible to have two different instances of same Eclipse version?

  4. 4

    how to connect two viewcontrollers to same navigationcontroller in storyboard iphone

  5. 5

    Same UIPickerView in different ViewControllers

  6. 6

    How can you have two records with the same field names?

  7. 7

    How do you send messages between different users of the same app?

  8. 8

    How do you subset a data frame that has different values for the same two columns in R

  9. 9

    How is it possible to have feeds from different Urls in the same ListView

  10. 10

    IBOutlet to two viewControllers on two storyboards... is that possible

  11. 11

    two codes Theoreticaly same but practicaly works different...how is it possible

  12. 12

    c++, is that possible to have two unions with the same name in different header files

  13. 13

    How do you assign an IBOutlet programmatically using Swift?

  14. 14

    Is it possible to have two functions with the same signature called under different contexts? (Attribute manipulation)

  15. 15

    How is it possible for two identical Docker images to have different packages installed?

  16. 16

    How do you check to see if two different file reference "strings" refer to the same file?

  17. 17

    How do you switch ViewControllers?

  18. 18

    How do they work when you have two graphic cards on Ubuntu?

  19. 19

    How can I do to associate a Xib to same viewcontrollers?

  20. 20

    how to connect two viewcontrollers to same navigationcontroller in storyboard iphone

  21. 21

    How do you subset a data frame that has different values for the same two columns in R

  22. 22

    two codes Theoreticaly same but practicaly works different...how is it possible

  23. 23

    How to have two different format of headings at the same “level” in a Table Of Content?

  24. 24

    I have viewcontrollers in a scrollview, but how do I start on a certain page?

  25. 25

    How to have two different intent filters for same activity?

  26. 26

    How do you change multiple CSS as the same time with different clicks?

  27. 27

    Same IBOutlet from different storyboards?

  28. 28

    Add same UITableView to different ViewControllers

  29. 29

    How do you have an ActionListener perform different events based on the actionPerformed?

HotTag

Archive