IOS simple pass value tool class (HTPassValueTool)

IOS simple pass-by-value tool class

  • Introduce tool class (HTPassValueTool)
  • It is easy to pass values ​​between objects between controllers .
  • This tool class is used as a singleton, and there is no need to create an object of this tool class.
  • The passed parameters can be any object, but does not include basic data types. Such as: int/float/char and other types. When these types are encountered, they can be encapsulated and then passed.
  • When passing and retrieving data, use the key value (KEY) as the value parameter.

How to use : 1. Set value: setValue (value, key);

                2. Value: getValue (key);

                3. Convert object name or variable name to string as KEY: NSString *varName = vs (object or variable);

                4. Get the tool class singleton: SHTPV

                5. Get the data storage dictionary: NSDictionary *dict = [SHTPV getDict] ;

                6. Clear all transmitted data: [SHTPV clearVars] ;

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327077427&siteId=291194637