myLabel.text = [NSString stringWithFormat:%i, intToPrint];
You have not described your problem well enough for anybody do help you.i will give you any info/pics of my code that you need to be able to help. with that being said it is a NSTimer that i am using for the score
If you don't know what properties are then you need to get a book on Objective C/iOS development and do some reading.viewController2.score = mainInt1;
If he doesn't know how to define a property then Key Value Coding is going to be way, way over his head.Can't you just use the listener observer pattern?
yes Duncan C the score goes up when the timer goes off and yes i have been reading in some beginner books but you said to use viewController2.score = mainInt1; that looks right now would i put that in the .h or .m. where do you think there are some good places to learn properties?
ArtOfWarfare i don't really have a lot of experience and i started with objective-c
Gak! That is an easy way to do it the same way that stretching a power wire across the floor from the oven is the easiest way to power your new dishwasher. It works, but you'll trip over that wire for the rest of your life, and your house might burn down next year because you've overloaded the house wiring.The easiest, fastest method is to stick the integer in a C global variable. You can read global variables from anywhere (with an extern declaration).
There are other more robust methodologies for code you plan on maintaining, giving to someone else to maintain, or code that you plan on unit testing or reusing. But very often, that is not the case. Most student apps are thrown away (for good reason). Might as well have another good reason.
Exactly correct. Since student programs are never maintained and smaller than one module of many real apps, there is no reason not to use the simplest coding technique. Globals. No need to make Johnny learn 767 landing procedures at LAX to take the trike for a spin around the backyard.Global variables create very tight binding between the different parts of your program. They destroy modularity. The end result is spaghetti-code. Difficult to figure out, difficult to maintain.
It depends on the goal of the student app. If the goal is to learn how to write REAL software, then teaching the student a dead-end solution that is poison to a real-world app is NOT a good idea.Exactly correct. Since student programs are never maintained and smaller than one module of many real apps, there is no reason not to use the simplest coding technique. Globals. No need to make Johnny learn 767 landing procedures at LAX to take the trike for a spin around the backyard.
Save it for apps that need it instead of wasting people's time and battery.
tags. This makes it easier for other to see the code as well as provides an option for them to more-easily copy the code should they want to test something on their own.
The problem is that many people must learn to write software before learning to write REAL software. Confusing the two goals often leads to them accomplishing neither.If the goal is to learn how to write REAL software...
What books? When referencing other resources, it is common courtesy here to give specifics about those resources. In the case of books: title, author, edition, (and, if appropriate, chapter and page number). For online tutorials, URLs....i will keep the books in mind i am reading a few right now...