Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6324177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:39:19+00:00 2026-05-24T16:39:19+00:00

I had a lot of .xib files and I try to recreate them programmatically.

  • 0

I had a lot of .xib files and I try to recreate them programmatically.

The only problem is, is that I can’t customize my navigationbar any more.

De versions function is called by another view with multiple bar button items, so the code is generic to other functions to.

- (void)versions
{
    VersionsViewController *verController = [[VersionsViewController alloc] initWithDocument:document];
    [verController setDelegate:self];

    [self loadPopupView:verController];

    [verController release];
}

- (void)loadPopupView:(UIViewController *)viewController
{
    if (popOverController != nil && [popOverController isPopoverVisible]) 
    {
        [popOverController dismissPopoverAnimated:YES];
    }

    if(![popOverController isPopoverVisible] || ![popOverController.contentViewController isKindOfClass:[viewController class]])
    {
        popOverController = [[UIPopoverController alloc] initWithContentViewController:viewController];
        popOverController.popoverContentSize = CGSizeMake(320, 500);

        UIBarButtonItem *buttonLocation;

        if([viewController isKindOfClass:[CommentaryViewController class]])
            buttonLocation = commentaryButton;
        else if([viewController isKindOfClass:[PropertiesViewController class]])
            buttonLocation = propertiesButton;
        else
            buttonLocation = versionsButton;

        [popOverController presentPopoverFromBarButtonItem:buttonLocation permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
    }
}

VersionsViewController.m

- (id)initWithDocument:(Document *)doc
{
    self = [super init];

    if(self)
    {
        self.document = doc;
        self.title = @"other title"; //does not work either

        //I just tried everything I could think of :P
        self.navigationController.navigationBar.tintColor = [UIColor orangeColor];
        self.navigationItem.titleView.backgroundColor = [UIColor redColor];
        self.navigationController.navigationItem.titleView.backgroundColor = [UIColor greenColor];
        self.navigationController.tabBarController.tabBar.backgroundColor = [UIColor blueColor];
        self.navigationController.navigationBar.backgroundColor = [UIColor purpleColor];
    }

    return self;
}

Can someone see what I did wrong?

EDIT:

NSLOG from self.title and self.navigationController.title are both ‘null’

When I create a navigationController add the view and add the navigationController to the popup i get 2 bars and then I can set the title of the navigationController but still not the color.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T16:39:20+00:00Added an answer on May 24, 2026 at 4:39 pm

    Just curious: if you have working nib files, why are your recreating them programmatically?

    In initWithDocument:, you haven’t assigned a nvaigationController yet. You’ll need to build one of those by hand, and install VersionViewController in it (navigationController will be set after you’ve done that). Having all of this work automatically is one of the reasons we use nib files.

    EDIT Anytime “nothing happens” check that the object you’re messaging is not nil. I’m certain navigationController is still nil when you get to it. You should also NSLog the objects you care about and look at their addresses. You probably are accidentally creating multiple views or multiple navigation controllers. This is very common to do when you try to build this stuff by hand. Nibs are the correct solution in most cases.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After searching a lot i did not get any answers and finally i had
My app requires a lot of image resources, so I've had to package them
Had a page that was working fine. Only change I made was to add
Had a good search here but can't see anything that gets my mind in
Had a problem with the recursive conflictCheck() method. That seems fine now. I have
I have had a lot of success creating graphs with Flot. However, I can
Suppose I had a file that had a lot of text in it. At
We have a database that had a lot of changed in both tables and
DB Designer had a lot of bugs but one outstanding feature was that database
I've had a lot of users complain that the little i info button is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.