Okay this is a design question. I, like many, are still learning Objective-C and Cocoa, and am a little rusty to boot. Anyway, here is the question:
Assume I have a ViewController class 'A'.
Assume I have a "Camera" class 'B', which is a singleton.
Assume I have a UILabel class 'C'.
The ViewController 'A' has knowledge of the "Camera" 'B' and can always easily get a reference to it by asking for B.sharedInstance
I set up a timer in 'A' which repeatedly calls a method in the "Camera" class 'B'.
Every time the method in 'B' is called by the timer, I also want to send a message to the UILabel 'C' as well....
Only, the "Camera" 'B' doesn't have any knowledge of the UILabel, so I can't update the UILabel in the camera's method which is being called by the timer.
The value the UILabel displays is from the "Camera". It needs to get that information immediately after the timer has called the timer-invoked method in the "Camera" class.
How do I design this properly so the UILabel 'C' can be properly informed of the changes in the "Camera" every time the timer calls its method.
If you're still with me, thank you for reading. Any advice would certainly be instructive. Thanks in advance for any help you can offer.
I realize I could pass the UILabel as an argument to the camera in the timer call, but that seems really ugly. And I could make the UILabel a singleton, and then the camera can call C.sharedInstance, which still makes sense in this program but that seems WAY wrong.
What is the right way to do this?