开发者

undeclared navigation object?

开发者 https://www.devze.com 2023-03-25 14:17 出处:网络
already i am declared navigation object like this UINavigationController *naviButtonpro; @property (nonatomic, retain) IBOutlet UINavigationController *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 resol开发者_Python百科ve this problem


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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消