未声明的导航对象?
我已经像这样声明了导航对象
UINavigationController *naviButtonpro;
@property (nonatomic, retain) IBOutlet UINavigationController *naviButtonpro;
,并且还声明了@synthesize naviButtonpro;
self.naviButtonpro = [[UINavigationController alloc] initWithNibName:@"NaviButtonViewController" bundle:nil];
[self.window addSubview:self.naviButtonpro.view];
当我使用这种方法时,
-(IBAction)displayNextPage:(id)sender
{
dispNext *gotoback = [[dispNext alloc] initWithNibName:@"dispNextView" bundle:[NSBundle mainBundle]];
//UINavigationController *naviButtonpro = [[UINavigationController alloc] initWithNibName:@"NaviButtonViewController" bundle:nil];
[self.naviButtonpro pushViewController:gotoback animated:YES];
[gotoback release];
}
我收到这样的错误 请求成员“naviButtonpro”不是结构或联合,
你能告诉我如何解决这个问题吗
already i am declared navigation object like this
UINavigationController *naviButtonpro;
@property (nonatomic, retain) IBOutlet UINavigationController *naviButtonpro;
and also declared @synthesize naviButtonpro;
self.naviButtonpro = [[UINavigationController alloc] initWithNibName:@"NaviButtonViewController" bundle:nil];
[self.window addSubview:self.naviButtonpro.view];
when i am using this method
-(IBAction)displayNextPage:(id)sender
{
dispNext *gotoback = [[dispNext alloc] initWithNibName:@"dispNextView" bundle:[NSBundle mainBundle]];
//UINavigationController *naviButtonpro = [[UINavigationController alloc] initWithNibName:@"NaviButtonViewController" bundle:nil];
[self.naviButtonpro pushViewController:gotoback animated:YES];
[gotoback release];
}
i am geting an error like this
Request for member 'naviButtonpro' in something not a structure or union
can u tell me the how to resolve this problem
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这里有 2 件事需要注意。
首先,您没有创建 UINavigationController。您需要分配 init 它。您似乎在代码中包含它,但它被注释掉了。
其次,dispNext需要子类化&继承自 UIViewController。它有这个功能吗?
2 things to note here.
Firstly, you aren't creating a UINavigationController. You need to alloc init it. You seem to have it in the code but its commented out.
Secondly, dispNext needs to subclass & inherit from UIViewController. Does it do this?
第一个问题是您初始化“naviButtonpro”的位置,第二个问题是
你的接口类继承了什么样的类?是 UIView 还是 UIViewController。
The first problem is where you are initializing the 'naviButtonpro' and second is
What kind of the class its inherited of your interface class ? is it UIView or UIViewController.