未声明的导航对象?

发布于 2024-11-27 05:21:39 字数 880 浏览 1 评论 0原文

我已经像这样声明了导航对象

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

贱贱哒 2024-12-04 05:21:39

这里有 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?

我一直都在从未离去 2024-12-04 05:21:39

第一个问题是您初始化“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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文