Title bar change in standard "Utility Program"

Discussion in 'iOS Programming' started by nomar383, Mar 27, 2009.

  1. nomar383 macrumors 65816

    nomar383

    Joined:
    Jan 29, 2008
    Location:
    Rexburg, ID
    #1
    Just a quick question:

    I have moved all of my current project's data into a standard "Utility Application" (Just a new Utility app in Xcode). How do I change the title bar on the "flipside" view controller. It seems to be using my projects name and I have no idea how to override it with what I want.

    I have tried:
    Code:
    self.title = @"Credits";
    in the FlipSideViewController class in the viewDidLoad method, but it still will not change. This same code does work in my mainViewController method (although that viewController specifically has a Navigation bar at the top). What's up?
     
  2. nomar383 thread starter macrumors 65816

    nomar383

    Joined:
    Jan 29, 2008
    Location:
    Rexburg, ID
    #2
    Is there really no way to change this? What am I missing?
     
  3. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #3
    I do the following in my loadFlipsideViewController:
    Code:
    UINavigationItem *navigationItem = [[UINavigationItem alloc] initWithTitle:@"About app"];
    [flipsideNavigationBar pushNavigationItem:navigationItem animated:NO];
    
     
  4. nomar383 thread starter macrumors 65816

    nomar383

    Joined:
    Jan 29, 2008
    Location:
    Rexburg, ID
    #4
    Cool, where would I put this in the code? And I'm guessing I have to release that *navigationItem somewhere?

    EDIT: I read the post again and know where to put it now lol. Can I release this object in the "dealloc" method?

    EDIT2: I actually didn't have to change anything but the initWithTitle: (it was all already there). I just didn't notice it in my code examination. Thanks a lot!
     
  5. nomar383 thread starter macrumors 65816

    nomar383

    Joined:
    Jan 29, 2008
    Location:
    Rexburg, ID
    #5
    Another question about the a utility-based app. When I tap the little "i" in the simulator, it reacts perfectly. However, when my app is installed on an actual iPhone, I have to hit that "i" button several times before it will respond. Any ideas?

    Here is the standard Apple code that was inluded when the button is pressed:

    Code:
    - (IBAction)toggleView {    
        /*
         This method is called when the info or Done button is pressed.
         It flips the displayed view from the main view to the flipside view and vice-versa.
         */
        if (flipsideViewController == nil) {
            [self loadFlipsideViewController];
        }
        
        UIView *mainView = mainViewController.view;
        UIView *flipsideView = flipsideViewController.view;
        
        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration:1];
        [UIView setAnimationTransition:([mainView superview] ? UIViewAnimationTransitionFlipFromRight : UIViewAnimationTransitionFlipFromLeft) forView:self.view cache:YES];
        
        if ([mainView superview] != nil) {
            [flipsideViewController viewWillAppear:YES];
            [mainViewController viewWillDisappear:YES];
            [mainView removeFromSuperview];
            [infoButton removeFromSuperview];
            [self.view addSubview:flipsideView];
            [self.view insertSubview:flipsideNavigationBar aboveSubview:flipsideView];
            [mainViewController viewDidDisappear:YES];
            [flipsideViewController viewDidAppear:YES];
    
        } else {
            [mainViewController viewWillAppear:YES];
            [flipsideViewController viewWillDisappear:YES];
            [flipsideView removeFromSuperview];
            [flipsideNavigationBar removeFromSuperview];
            [self.view addSubview:mainView];
            [self.view insertSubview:infoButton aboveSubview:mainViewController.view];
            [flipsideViewController viewDidDisappear:YES];
            [mainViewController viewDidAppear:YES];
        }
        [UIView commitAnimations];
    }
    Looks fine to me. I played around in Interface Builder and all appears peachy there as well...

    EDIT: wtf as soon as I change the icon to "Detail Disclosure" instead of the "i", it works fine. Ugh. I guess that's what I'll use then!
     
  6. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #6
    You could but that kinda goes against the HIG.
     
  7. nomar383 thread starter macrumors 65816

    nomar383

    Joined:
    Jan 29, 2008
    Location:
    Rexburg, ID
    #7
    Well I dunno what else I'm supposed to do and it looks fine to me. If you have a suggestion I'm all ears :p
     
  8. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #8
    If you aren't satisfied with the tap area for the 'i', perhaps place a transparent custom button in front of it that calls the same action and enlarges the tap area.
     
  9. nomar383 thread starter macrumors 65816

    nomar383

    Joined:
    Jan 29, 2008
    Location:
    Rexburg, ID
    #9
    Good idea, I'll give that a shot
     

Share This Page