我的功用是: 我以以下具体方式宣布了单一州:rel=“nofollow noreferer”>http://coa withlove.com/2008/11/singletons-appdelegates-and-top-level.html。
我的单一州有4个申报财产:3个浮标和1个 in。 现在,我认为,控制者在更新后Singleton方法中确定了类似财产:
[[Singleton sharedSingleton] setMyInt: var1];
[[Singleton sharedSingleton] setMyFloat1: var2];
[[Singleton sharedSingleton] setMyFloat2: var3];
[[Singleton sharedSingleton] setMyFloat3: var4];
在我看来DidLoad方法中,我获得这样的财产:
int m = [[Singleton sharedSingleton] myInt];
float r = [[Singleton sharedSingleton] myFloat1];
float g = [[Singleton sharedSingleton] myFloat2];
float b = [[Singleton sharedSingleton] myFloat3];
然后,我将直面价值分配给一个统法协会,并向UISliders分配浮动价值。 因此,问题在于,每当我掌握我的照片时,浮标就存放在单一州,直到我确定时为止——如果我确定浮标,然后确定浮标,则浮标总是重新开始,每次都要求查看DidLoad。 因此,顺序是:
1)launch the app
2)flip the view and set the floats(r, g, b)
3)flip the view back to Main
4)flip the view back to Flipside and the floats are set to the previous values. Now set the int.
5)flip back to Main
6)flip the view back to Flipside and the int is set to the previous value but the floats are set 0
任何想法?