I have two view controllers and I want to share a bool variable between them. So I create a bool variable with a @propery (nonatomic, assign) on both sides and on the one side I wrote
newVC.myBool1 = self.myBool2;
On the other view controller I can read the value of the passed bool variable, but I need to change it at the second view controller so I can read the value at the first view controller. So I know, this is not possible, because `bool* it is a primitive type.
因此,我使用了<条码>NSNumber,但这也不可行。 关于第一种看法,控制器一在<代码>上设定
self.myBool1 = [NSNumber numberWithBool:NO];
关于第二个观点,控制者:
self.myBool2 = [NSNumber numberWithBool:YES];
但第一种看法是控制器的价值为0-NO......。 因此,创建新的<代码>NSNumber似乎不向第一观察控制员分享。
What can I do to solve this problem? Regards Tim