Results 1 to 2 of 2
Discuss Problem with addSubview method at the iPhone Developer Exchange - Hackint0sh.org; Hi there, I am currently trying to create a tableView with an UINavigationController bar with ...
  1. #1
    Newbie Array

    Join Date
    Nov 2008
    Posts
    2
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default Problem with addSubview method

    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
    Code:
    - (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];
    
    }
    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 subView

    Like That:
    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];
    }
    and i have this result.:



    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



  2. #2
    Newbie Array

    Join Date
    Nov 2008
    Posts
    2
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default

    Nobody Can help me ???

 

 

Similar Threads

  1. Speaker problem with Ziphone unlock method
    By konkar in forum iPhone "2G" (Rev. 1)
    Replies: 2
    Last Post: 02-12-2008, 11:57 PM
  2. [1.1.2 (1.0.2 OTB)][Problem]proper restore method
    By wireless in forum iPhone "2G" (Rev. 1)
    Replies: 1
    Last Post: 01-19-2008, 01:34 AM
  3. Problem with *#307# method
    By twhite in forum iPhone "2G" (Rev. 1)
    Replies: 7
    Last Post: 11-23-2007, 10:59 PM
  4. /usr/sbin/update method problem
    By marceli in forum Free Toolchain Software (Cydia App's)
    Replies: 1
    Last Post: 08-14-2007, 12:52 AM
  5. Replies: 7
    Last Post: 07-12-2007, 07:43 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Powered by vBulletin®
Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.
Search Engine Friendly URLs by vBSEO
(c) 2006-2012 Hackint0sh.org
All times are GMT +2. The time now is 10:43 AM.
twitter, follow us!