After reading a bunch of stackoverflow posts and forums I got really confused on this subject. Alot speak about using delegates, but can result in memory problem if there is a big amount of data.
I am only to handle around 600-bytes of data from a TCP/IP device and override the existing value with the new.
I have made a RootViewController which has a special view and the TCP/IP socket, furthermore I have two other ViewControllers which has to use data from the RootViewController (TCP/IP).
Should I perhaps make a seperate class for the TCP stuff instead of mixing it up in my RootViewController?
Also how should I handle the sharing of data across the ViewControllers?
Thanks in advance.
For sharing data among classes you can use notifications mechanism. Post a notification in your FromClass.m:
In your ToClass.m viewDidLoad add this:
…and somewhere in your ToClass.m add this method:
Also add this in your ToClass.m viewDidUnload to release observer object when view will be unloaded: