我想設置一個布爾值。我可以成功地設置它,但是,在另一個班級中,所反映的變化不會顯示出來。外部變量不更新
下面是一個例子:
File1中:
@implementation ClassOne //UIViewController
extern BOOL theValue;
- (void)loadFile {
theValue = YES;
}
...
@end
文件2:
@implementation ClassTwo //UIViewController
BOOL theValue;
- (void)switchValueChanged {
theValue = NO;
}
@end
我initally設置在一個類中的值,用YES的初始值。但是,當我將ClassTwo中的值設置爲NO並返回到ClassOne時,該值仍爲YES。
我有點卡住了。你會認爲它會更新。但事實並非如此。
任何幫助表示讚賞。完成你所追求的
也許會顯示一些更多的代碼和它的確切位置,即什麼方法等。 – Eiko 2010-12-11 09:52:52