Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your problem is typically solved by using the <a href="http://en.wikipedia.org/wiki/Model-view-controller" rel="nofollow noreferrer">Model-View-Controller</a> pattern. In this case, your "model" will be an object that stores the numbers and also does the computations with those numbers. Your "view" here will be the views in each tab -- the first tab visualizing the computations, the second tab visualizing the numbers. The "controller" here will be your existing <code>UIViewController</code> objects (or subclasses thereof) -- in the first tab, responding to changes in the data model and updating the (say) <code>UILabels</code> accordingly, in the second tab, changing the numbers in the data model when the user, for example, modifies the value on a <code>UISlider</code> or in a <code>UITextView</code>.</p> <p>Create this data model object (which should just be a subclass of <code>NSObject</code>) in your application delegate, add it as a interface member/property in your view controllers, and pass it to both view controllers when the app starts up. Updating the data model is as simple as having the second view controller call methods and/or change properties in the data model related to various values it uses.</p> <p>You complete the implementation of this pattern with the observation part. Here, you can either have your view controllers use <a href="http://developer.apple.com/mac/library/documentation/cocoa/Conceptual/KeyValueObserving/KeyValueObserving.html" rel="nofollow noreferrer">Key-Value Observing</a> (might be simplest) to watch data members in the data model, or you can have the data model emit <a href="http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Notifications/Introduction/introNotifications.html" rel="nofollow noreferrer"><code>NSNotifications</code></a> which your view controller would then register to receive (might be harder).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload