Hi there,
I am currently trying to create a tableView with an UINavigationController bar with an Add button.
like that :
I Just have a Windows nib and create the table by a viewcontroller, the navigation bar and the tab bar in the appdelegate.m
Like that:
-iCookAppDelegate.m
My probleme is when I click on the add button, I want to open a new view (via an other view controller), so I create an add method in the "IngredientController" and I add a subViewCode:- (void)applicationDidFinishLaunching:(UIApplication *)application { window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Create the array of UIViewControllers NSMutableArray *controllers = [[NSMutableArray alloc] init]; // Load the Ingredient Controller IngredientController *ingredientControl = [[IngredientController alloc] initWithStyle:UITableViewStylePlain]; UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:ingredientControl]; nav.navigationBar.barStyle = UIBarStyleBlackOpaque; [controllers addObject:nav]; [ingredientControl release]; [nav release]; for (int i = 1; i < 4; i++) { BrightnessController *bControl = [[BrightnessController alloc] initWithBrightness:i]; UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:bControl]; nav.navigationBar.barStyle = UIBarStyleBlackTranslucent; [controllers addObject:nav]; [bControl release]; [nav release]; } // Create the toolbar and add the view controllers UITabBarController *tbarController = [[UITabBarController alloc] init]; tbarController.viewControllers = controllers; //tbarController.customizableViewControllers = controllers; tbarController.delegate = self; // Set up the window [window addSubview:tbarController.view]; //[window addSubview:[ingredientControl view]]; [window makeKeyAndVisible]; [controllers release]; }
Like That:
and i have this result.:Code:- (void)add{ //Initialize the controller. if(svController == nil){ self.svController = [[AddIngredientController alloc] initWithStyle:UITableViewStylePlain]; UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:svController]; nav.navigationBar.barStyle = UIBarStyleBlackOpaque; } //Add the view as a sub view to the urrent view. [self.parentViewController.view addSubview:nav.view]; }
I want remplace the parent view cause i want remplace the navigation bar by a searchview controller (I think I have a problem here and i probably do a confusion between remplace a view and a controlleur.
So my question are:
- why I have a space between the the top of the screen and the top of my view (so i can see the subview) an do you have some tips to resolve that ?
- How I can insert an animation when i add a subview ?
If you can help me you will have my eternal gratitude![]()



LinkBack URL
About LinkBacks











Reply With Quote

Bookmarks