我运行Mac OS X狮子和Xcode-4.2的UIViewController对象的属性不能访问
在我的应用程序中的AppDelegate.m中:didFinishLaunchingWithOptions方法我有以下的提取物。
UIViewController *viewController1 = [[WSWFirstViewController alloc] initWithNibName:@"WSWFirstViewController" bundle:nil];
UIViewController *viewController2 = [[WSWSecondViewController alloc] initWithNibName:@"WSWSecondViewController" bundle:nil];
self.tabBarController = [[TabBarController alloc] init];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, viewController2, nil];
self.window.rootViewController = self.tabBarController;
[self.tabBarController showSplash];
[viewController1 displayItems];
我试图做的是访问viewController1对象,它是类型WSWFirstViewController的displayItems财产。
在WSWFirstViewController.h我
@property (retain, nonatomic) NSMutableArray *displayItems;
在WSWFirstViewController.m我已经@synthesized displayItems。
我似乎无法弄清楚,为什么我得到一个:
住宅“displayItems”上输入“*的UIViewController”的对象没有找到。
直到我注意到我的对象(viewController1)不是UIViewController *类型,而是WSWFirstViewController *。但仍然没有帮助我更进一步。
任何意见是赞赏!
这就是您重复使用生成的代码所得到的结果。感谢您指出了这一点! –
很高兴有帮助! – sergio