0
嗨访问和编辑字符串我已经看到了这个问题的答案:存储,在AppDelegate中
How to pass a value from one view to another view
而且我遇到了一些麻烦。我在AppDelegate的头文件中存储了一个字符串。
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
{
NSString *commString;
}
@property (strong, nonatomic) UIWindow *window;
@end
我现在需要访问它并在一个视图中进行更改。然后在另一个视图中显示它。上一页的答案简要解释了这一点,但我在答案的第二部分遇到了问题。它不会让我这样做:
AppDelegate.commString = myString; //mystring being an NSString
任何想法请吗?
谢谢
谢谢,我一直在学习感谢这个网站。 @synth允许accesors和mutators是啊?我会在两个视图中合成它,还是在AppDelegate.m中使用它? – dev6546 2012-08-11 14:43:53
您只能在.m文件中同步.m文件的名称与您在其中声明的.h文件的名称相同。也就是说,您只能在AppDelegate.m文件中合成窗口和commString。 – CodaFi 2012-08-11 14:46:29