iphone - How to obtain UITextFields from a singleton -


In order to calculate in three view controllers, I need only four parameters. The parameters come in four scenes before UITextFields. I am not using global variables, but have developed a singleton class to enable the available parameters for each controller. I can reference the fine variable in the controllers, but I do not know how to start them. I have received the variable from the first view controller through a window developed with IB but there can be no way to get it in the earliest manner in singleton.

Thankfully appreciate the guidance and guidance.

  // // ProjectEstimator // // This is an overview class that is used to control global parameters for use in various view controllers. // // // // 10/06/2010 created by Frank Williamson // #Emportant & lt; Foundation / Foundation. H & gt; @ Interface Global Parameters: NSobis {// Any "global" variable can be found here at // float * process; // float * entities; // float * transaction; // float * user; IBOutlet UITextField * noOfProcesses; IBotlet Uitfeld Field * No off Antiquity; IBotlet Uitfeld Field * No effectation; IBOutlet UITextField * noOfUserArea; } @protecti (retaining, nonetomic) uitfestfield * noopsis; @protecti (retaining, notatomomic) uTitisfield * no off antiquity; @protecti (retaining, nonetomic) uitdefilled * no effectation; @protecti (retaining, notatomic) uTitisfield * NO OFUSERIA; / / The message from which we got our example (+ Global Permats *) is shared person; @end // // GlobalParameters.m // ProjectEstimator for singleton handling (global) parameters // // Created on February 10, 2010 by Frank Williamson // #import "GlobalParameter H" @implementation GlobalParameters; @ Synthesis nof process; @ Synthesis not antiquity; @ Synthesis nofrotectation; @ Synthesis noofuser area; + (Global Permatators *) Shared Instructions {// Example of this class has been submitted here Fixed Global Parameters * noOfProcesses = zero; Fixed Global Parameters * noOfEntityClusters = Zero; Fixed Global Parameters * noOfTransactions = Zero; Static Global Parameters * Nofuussarrea = Nil; // Check if an example already exists if (zero == noof process) {noOfProcesses = [[[self class] alloc] init]; // How do I start UITextFields from a View Controller here? **} // Return an example of this class return no of processor; If (zero == no off intensity cluster) {noOfEntityClusters = [[[self class] alloc] init]; // How do I start UITextFields from a View Controller here? **} // Return an example of this class return no off entity cluster; If (zero == noOfTransactions) {noOfTransactions = [[[self class] alloc] init]; // How do I start UITextFields from a View Controller here? **} // Return an example of this class return noftransactions; If (Zero == noofusiaia) {noOfUserArea = [[[Self class] alloc] init]; // How do I start UITextFields from a View Controller here? **} // Return the example of this class return no fuser area; } @end  

There are several things that I'll change first, I'm a "globals Second, if I did, I would not collect UIView objects in the class designed to be "model" anytime. Thirdly, if I need to implement a singleton, then I will follow cocoa.

I need only four parameters to calculate in three view controllers.

And at the time, I suggest that you throw this class completely and think again about your design problem. Is it only you to store four NSString parameters (or NSNumber s or NSInteger s or float s) Need or ...)? If so, it is a full overkill to store the parameters inside a visual square. Simply create a simple class to store the parameters, whose title will look something like this:

@interface MyParameters: NSObject {NSString * someString; Nsnm * few numbers; NSInteger someInteger; Float some floats; } @property (nontomic, write) NSString * someString; @property (nontomic, rETAIN) nsnm * few numbers; @property (nanatomic, assign) NSINTEGER some integer; @protecti (nonatomic, assigned) float float; @end

I would like to migrate any object of this class to my application representative or my root view controller, and then I will pass it along with other view controllers which it has access to Required. Finally, I will use each visual controller, which will automatically get updates for any changes in the parameters if needed.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -