tags:

views:

170

answers:

2

i'm download DrillDownApp example project from iPhoneSDKArticles

i have a problem when i'm try to add menu page before load MainWindow.

i can't load [window addSubview:[navigationController view]]; on other class except on DrillDownAppAppDelegate.m

could you explane me or give me some tutorial how to add menu page on DrillDownApp please

i'm new to iphone development, need some advise please , thanks all

A: 

Hi

Im not entirely sure on what you want to achieve, but I think you want to add a view to something that is not the appDelegate that instantiates the navigationController.

To add view to the navigationController you use:

    MYViewController *viewController = [[MYViewCOntroller alloc]
           initWithNibName:@"MYViewController" bundle:nil];
[self.navigationController pushViewController:viewController animated:YES];
[viewController release];

If you just want to add a view to another view you should use:

    MYViewController *viewController = [[MYViewCOntroller alloc]
         initWithNibName:@"MYViewController" 
         bundle:nil];
[self.view addSubView:viewController.view]

Was this what you needed? :)

RickiG
A: 

thank RickiG for your post

my first problem already fix i load menu page complete for now

second problem

according to DrillDownApp example project from iPhoneSDKArticles i add menu page and then when i press some buttone i call method that contain this code

[window addSubview:[navigationController view]]; [window makeKeyAndVisible];

to make UITableView visible but it doesn't work.

i complete load menu page and i add this button to call MainWindow could you help me about this error

  • (IBAction) btnClickMe_Clicked:(id)sender {

    RootViewController *hvc = [[RootViewController alloc] initWithNibName:@"MainWindow" bundle:[NSBundle mainBundle]];

    self.hvController = hvc;

    [hvc release];

    [self.view addSubview:[self.hvController view]];

}

this is error log when i click this button

[Session started at 2009-11-10 11:59:56 +0700.] 2009-11-10 11:59:59.374 DrillDownApp[1860:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key delegate.' 2009-11-10 11:59:59.377 DrillDownApp[1860:207] Stack: ( 29316187, 2478350153, 29475265, 248440, 246981, 4584648, 29219119, 4579199, 4587467, 3273055, 3266619, 4632306, 3266337, 23430, 2745433, 3152802, 3161539, 3156751, 2850355, 2758684, 2785461, 37412561, 29100928, 29097032, 37406605, 37406802, 2789379, 10476, 10330 )

RAGOpoR
You lost me there RAGOpoR …From where do you call this code? this code should only be called once and if you selected to build a navigation based application this is all done for you by Xcode.Don't you already have a navigationController instantiated? if this is the case just use pushViewController to add new view, as I wrote earlier.
RickiG