8 comments on “Colouring fun with moreNavigationController

  1. Hi, thank you very much for such nice tutorial.
    i am just trying to customize the “EDIT BUTTON” by adding the background image to that button.
    Can you please guide me for that ?

  2. Hey, I’m really starting out.

    How do you implement the UITabBarControllerDelegate in your App Delegate so that you can then add code to change the edit bar to orange?

    Thanks

  3. I think I’m missing something obvious

    my .h looks like this

    #import

    @interface AppDelegate_iPhone : NSObject {
    UIWindow *window;
    UITabBarController *tabBarController;
    }

    @property (nonatomic, retain) IBOutlet UIWindow *window;
    @property (nonatomic, retain) IBOutlet UITabBarController *tabBarController;

    @end

    and my .m looks like this pieces

    // …

    @synthesize tabBarController;

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    // …

    tabBarController = [[UITabBarController alloc] init];
    tabBarController.viewControllers = [NSArray arrayWithObjects:
    navController1,
    navController2,
    navController3, nil];

    [window addSubview:[tabBarController view]];

    // …

    }

    - (void)tabBarController:(UITabBarController *)tabBarController willBeginCustomizingViewControllers:(NSArray *)viewControllers {
    UIView *editView = [tabBarController.view.subviews objectAtIndex:1];
    UINavigationBar *modalNavBar = [editView.subviews objectAtIndex:0];
    modalNavBar.tintColor = [UIColor orangeColor];
    }

    But it’s still blue instead of orange.

    Everything I’ve read says this should work and it’s not crashing the app.

    Thanks for all the help :) Can you see anything obvious?

  4. You need to make your Application Delegate class adhere to the UITabBarController delegate methods. In your .h file write:

    @interface AppDelegate_iPhone : NSObject {

    I’ve included the other ones, since these are good to have.

    Then in your .m file:

    tabBarController = [[UITabBarController alloc] init];
    tabBarController.delegate = self;

    Now that method is called. If you’re ever in doubt why a delegate method isn’t working, try setting a break point at it, and if there’s no break when you think it should have been called, you’ll know for sure that you have forgotten to make your class adhere to whatever object’s delegate methods.

    Hope that helps.

  5. Hi Rune!
    Great tutorial. One question though:
    I’ve managed to change the background color of the tableview, but I can’t figure out how to change the color of the text in the cells. Any ideas?

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>