我花了很多时间试图弄清问题是什么......但没有成功。
我的代码如下:
ResultGoalViewController *resultGoalViewController = [[ResultGoalViewController alloc] initWithNibName:@"ResultGoalViewController" bundle:nil];
[self.goalNavigationController pushViewController:resultGoalViewController animated:YES];
我收到错误: “错误:请求成员'goalNavigationController',而不是结构或联合。”
我的班级是UIViewController。 goalNavigationController是一个导航控制器(在选项卡控制器中定义)。
我错过了什么?
答案 0 :(得分:4)
goalNavigationController
应该是UIViewController
子类中的属性或访问者。
答案 1 :(得分:4)
听起来self
没有goalNavigationController
属性。如果确实如此,你应该发布它声明的地方,以便我们看到它。
答案 2 :(得分:0)
谢谢Chuck,谢谢Mipadi。
我在委托应用程序中有一个goalNavigationController属性。
@interface MyAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
UITabBarController *mytabBarController;
NavigationGoalViewController *goalNavigationController;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) NavigationGoalViewController *goalNavigationController;
@end
但它不在我当前的UIViewController类中,因为我的goalNavigationController是在我的委托应用程序中首次构建/调用的。我现在从导航的第一个视图的ViewController调用它(我正在尝试加载导航控制器的第二个视图)。