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 7439947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:46:45+00:00 2026-05-29T10:46:45+00:00

My questions is next: For example I have object A (this is data model

  • 0

My questions is next:

For example I have object A (this is data model object). Assume that object A have some property (for example request property). Also I have object B (this is my view object).

So my problem is next: when my data model will be changed (the value for request property changed) I want to know about this events in my view (object B)

How to create this interaction between object.

For example in request is written to “some_value” and after this object B immediately know about it.

Thanks for response!

  • 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-05-29T10:46:45+00:00Added an answer on May 29, 2026 at 10:46 am

    I would use Key Value Observing. Your view controller (not the view itself) would set itself up as an observer for the data model object and when it gets observer notifications, it would update the view.

    [myDataObject addObserver: myViewController 
                   forKeyPath: @"request"  
                      options: NSKeyValueObservingOptionNew
                      context: nil];
    
    // in the view controller you need
    
    -(void) observeValueForKeyPath: (NSString*) path
                          ofObject: (id) aDataObject
                            change: (NSDictionary*) changeDictionary
                           context: (void*) context]
    {
        if (aDataObject == myDataObject
            && [path isEqualToString: @"request"])
        {
            // change you are interested in
        }
        // Call suoer implementation of this method if it implements it
    }
    

    Don’t forget to remove the observer when you are done with it.

    Also, be careful in a threaded environment. Observations are notified on the same thread that the change happens on. If this is not the main thread, you’ll need to use -performSelectorOnMainThread:withObject:waitUntilDone: to make any changes to the UI.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The questions says everything, take this example code: <ul id=css-id> <li> <something:CustomControl ID=SomeThingElse runat=server
Two questions: Can someone point me to unbiased data that compares .NET performance to
I have an object that contains two arrays, the first is a slope array:
Just a very general question, that not only applies to this example. Let's say
Suppose I have some per-class data: (AandB.h) class A { public: static Persister* getPersister();
This helpful idea from Andy Gaskell supports 50% of my next question: I'd like
This is a followup on the question: ASP.NET next/previous buttons to display single row
This is an extension / next step of this question I asked a few
Several questions about functional programming languages have got me thinking about whether XSLT is
I'm following the Data Access Object pattern, along with Factory (edit: sorry if I'm

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.