【发布时间】:2011-09-05 11:17:37
【问题描述】:
我的应用名称是 PropertiesSearch,因此该项目包含以下文件:
PropertiesSearchAppDelegate.h
PropertiesSearchAppDelegate.m
PropertiesSearchViewController.h
PropertiesSearchViewController.m
我在 PropertiesSearchAppDelegate.h 中声明了一个实例变量 (ListingNav),如下所示:
#import <UIKit/UIKit.h>
@class PropertiesSearchViewController;
@interface PropertiesSearchAppDelegate : NSObject <UIApplicationDelegate> {
UINavigationController *ListingNav;
}
@property (nonatomic, retain) UINavigationController *ListingNav;
@end
在 PropertiesSearchAppDelegate.m 中,我添加了
@synthesize ListingNav;
现在我正在尝试从 PropertiesSearchViewController.m 访问 ListingNav,如下所示:
PropertiesSearchAppDelegate *appDelegate = (PropertiesSearchAppDelegate *)[[UIApplication sharedApplication] delegate];
// Then here I can easily do appDelegate.ListingNav etc...
但调试器正在显示:
使用未声明的标识符PropertiesSearchAppDelegate
我应该在 PropertiesSearchViewController.h 中导入 PropertiesSearchAppDelegate.h 吗?
提前感谢您的帮助
斯蒂芬
【问题讨论】:
标签: iphone ios ios4 uiapplicationdelegate uiapplication