Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7907639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:33:04+00:00 2026-06-03T11:33:04+00:00

After reading a bunch of stackoverflow posts and forums I got really confused on

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T11:33:06+00:00Added an answer on June 3, 2026 at 11:33 am

    For sharing data among classes you can use notifications mechanism. Post a notification in your FromClass.m:

    NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:yourTCPData, @"TCPData", nil];
    [[NSNotificationCenter defaultCenter] postNotificationName:@"gotTCPData" object:nil userInfo:options];
    

    In your ToClass.m viewDidLoad add this:

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(makeSomeThingUsefulWithTCPData:)name:@"gotTCPData" object:nil];
    

    …and somewhere in your ToClass.m add this method:

    - (void)makeSomeThingUsefulWithTCPData:(NSNotification *)notification {
      NSDictionary *dict = [notification userInfo];
      yourTCPDataClass *yourTCPDataObject = [dict objectForKey:@"TCPData"];
      // Here make something useful with your TCP data
      }
    

    Also add this in your ToClass.m viewDidUnload to release observer object when view will be unloaded:

    [[NSNotificationCenter defaultCenter] removeObserver:self];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After reading this article on thedailywtf.com, I'm not sure that I really got the
After reading http://www.w3schools.com/tags/tag_noscript.asp confused about onclick event on noscript tag. Anybody knows the purpose?
After reading a description about swapping pointer addresses on Stackoverflow, I have a question
After reading some posts like this one: Choose File Dialog It appears that Android
After reading a few posts here I formulated this function which is sort of
Beginner programmer here. after a bunch of reading about 'variables' which dont exist in
After reading this post I kinda felt in the same position as the guy
After reading the wikipedia article on WPF architecture, I am a bit confused with
After reading this: http://docs.djangoproject.com/en/dev/ref/contrib/csrf/#how-to-use-it I came to the conclusion that it is not valid
After reading this question , I've learned that denormalization is not a solution for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.